"Joe User" <jo*@user.com> wrote in news:bs**********@tribune.mayo.edu:
QUESTION for the experts out there :)
Is it possible to write a query that would list the datafields by each
table in a database? How would I do that?!?!
TIA
Joe
Assuming a modern version of Access:
Sub GetColumnNames()
Dim r As ADODB.Recordset
Dim Table As String
Set r = CurrentProject.Connection.OpenSchema(adSchemaColum ns)
With r
Do While Not .EOF
If .Fields("TABLE_NAME") <> Table Then
Debug.Print .Fields("TABLE_NAME").Value
End If
Debug.Print , .Fields("COLUMN_NAME").Value
Table = .Fields("TABLE_NAME").Value
.MoveNext
Loop
End With
End Sub
This gives the columns of queries too. You will have to do some filtering
to get just your tables.
--
Lyle
(for e-mail refer to
http://ffdba.com/contacts.htm)