Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to get colmn names of a table(dynamic)
Message
De
24/04/2002 09:24:19
 
 
À
24/04/2002 08:01:36
Information générale
Forum:
Visual Basic
Catégorie:
Access
Divers
Thread ID:
00648557
Message ID:
00648628
Vues:
24
The following ADO code might help!

It prints the table name and field names to the immediate window.

Pass it a table name as a parameter.

Sub FieldList(table As String)
Dim rst As Recordset
Dim dbs As Database
Dim counter As Long
Dim strName As String
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset(table)
Debug.Print table & Chr(13) & Chr(10)
With rst
.MoveLast
Debug.Print "Records: " & CStr(.RecordCount)
For counter = 1 To .Fields.count
strName = .Fields(counter - 1).Name
If InStr(strName, " ") Then
strName = "[" & strName & "]"
End If
Debug.Print strName
Next
End With
Set dbs = Nothing
Set rst = Nothing
End Sub
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform