Purdue2479
Registered User.
- Local time
- Today, 18:47
- Joined
- Jul 1, 2003
- Messages
- 52
I am trying to use the below code to list in a table all the tables and there associated field names in the database excluding the system tables. What I am having trouble with is excluding the system tables. I'm not sure how to modify the code to do this. Any suggestions would be appreciated.
Code:
Private Sub showtdf()
Dim db As Database
Dim tdf As TableDef
Dim x As Integer
Dim tbl_Name As String
Dim tbl_Field As String
DoCmd.SetWarnings True
Set db = CurrentDb
If Left(tbl_Name, 4) <> "MSys" Then
For Each tdf In db.TableDefs
'Debug.Print tdf.Name,
'Debug.Print tdf.Fields.Count
'Debug.Print tdf.Fields(x).Name,
tbl_Name = tdf.Name
For x = 0 To tdf.Fields.Count - 1
tbl_Field = tdf.Fields(x).Name
DoCmd.RunSQL "INSERT INTO Table1 ([Table Name],[Table Field] ) Values ('" & tbl_Name & "','" & tbl_Field & "');"
Next x
Next tdf
End If
DoCmd.SetWarnings True
End Sub