Lista de campos de una tabla access

Modo resumido
[VB]
Sub CamposDeTabla1()
Dim dbs As DAO.Database
Dim tdf As DAO.TableDef
Dim fld As DAO.Field
Set dbs = OpenDatabase(“i:\intex winbol2000\E999\car.mdb”)
Set tdf = dbs.TableDefs(“CART0001″)
For Each fld In tdf.Fields
Debug.Print fld.Name
Next
Set fld = Nothing
Set tdf = Nothing
dbs.Close
End Sub
[/VB]


Modo ampliado
[VB]
Sub CamposDeTabla()
Dim dbs As DAO.Database
Dim tdf As DAO.TableDef
Dim fld As DAO.Field
Set dbs = OpenDatabase(“i:\intex winbol2000\E999\car.mdb”)
Set tdf = dbs.TableDefs(“CART0001″)
For Each fld In tdf.Fields
Select Case fld.Type
Case 1 ‘ Boolean
Debug.Print fld.Name
Case 4 ‘ Long
Debug.Print fld.Name
Case 7 ‘ Double
Debug.Print fld.Name
Case 8 ‘ Date
Debug.Print fld.Name
Case 10 ‘ Text
Debug.Print fld.Name
Case 12 ‘ Memo
Debug.Print fld.Name
Case Else
Debug.Print fld.Name
End Select
Next
Set fld = Nothing
Set tdf = Nothing
dbs.Close
End Sub
[/VB]

Tags: , , ,

About Alex Borrás

Informático, especializado en desarrollo Web con WordPress, Redes Sociales y posicionamiento en buscadores (SEO). Fan de la OOP y como afición jugador de Ajedrez. Geek por vocación & iphonero.
?????????