Build A Table Of Database Structure

DALIEN51

Registered User.
Local time
Today, 02:05
Joined
Feb 26, 2004
Messages
77
Access 2000: How can I populate a two field table (1. Table Name 2. Field Name) with the name of ever field within every table in my database using VBA code?

Regards,

Dalien51
 
I'm not quite sure what you need this for but you may want to glance at the sys tables to see if they can provide what you need....
 
It's Ok I Worked It Out!

This code does the trick!

Public Function buildfieldlist()

Dim myTables As TableDefs
Dim myTable As TableDef
Dim myField As Field
Dim myStructure As Recordset

Set myTables = CurrentDb.TableDefs
Set myStructure = CurrentDb.OpenRecordset("tbl_Structure")

For Each myTable In myTables

If Left(myTable.Name, 4) <> "tbl_" Then
GoTo ONWARD
End If

For Each myField In myTable.Fields

myStructure.AddNew
myStructure![Table Name] = myTable.Name
myStructure![Field Name] = myField.Name
myStructure.Update

Next myField

ONWARD:
Next myTable

End Function

Regards,

Dalien51
 

Users who are viewing this thread

Back
Top Bottom