Liste des champs
Pour la liste des champs en DAO, n'oubliez pas de cocher la référence DAO
Function FieldListDAO()
Dim dbs As DAO.Database
Dim tdf As DAO.TableDef
Dim fld As DAO.Field
Set dbs = CurrentDb
For Each tdf In dbs.TableDefs
If tdf.Attributes = 0 Or tdf.Attributes = dbAttachedTable Then
For Each fld In tdf.Fields
Debug.Print tdf.Name & " -- " & fld.Name
Next fld
End If
Next tdf
Set fld = Nothing
Set tdf = Nothing
Set dbs = Nothing
End Function
Pour la liste des champs en ADO, n'oubliez pas de cocher la référence ADO
Function FieldListADO()
Dim cnn As ADODB.Connection
Dim rst As ADODB.Recordset
Dim f As ADODB.Field
Set cnn = CurrentProject.Connection
Set rst = New ADODB.Recordset
rst.Open "LaTable", cnn
For Each f In rst.Fields
Debug.Print f.Name
Next
Set cnn = Nothing
Set rst = Nothing
End Function
Dernière modification : 26/09/2010 18:10
Catégorie : - Tables
Page lue 10048 fois