Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to get colmn names of a table(dynamic)
Message
From
24/04/2002 09:24:19
 
 
To
24/04/2002 08:01:36
General information
Forum:
Visual Basic
Category:
Access
Miscellaneous
Thread ID:
00648557
Message ID:
00648628
Views:
23
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
Previous
Reply
Map
View

Click here to load this message in the networking platform