Hi,
Here is a sample bit of code that will search all the tables and will print table and field names. This code should be placed in a module. As you probably know, the Debug.Print statement will put the results in the Immediate window (accessed via CTRL-G). If necessary, you can then highlight the code and paste into Word, then print.
Public Sub GetTableObjects()
Dim db As Database
Dim tbl As TableDef
Dim Fld As Field
Set db = CurrentDb
For Each tbl In db.TableDefs
Debug.Print "Table: " & tbl.Name & " ***"
For Each Fld In tbl.Fields
Debug.Print Fld.Name
Next Fld
Next tbl
End Sub
You can easily run this code from inside the Module object. Open up the module, place the cursor on the title line (Public Sub Get.....), then click the Run Macro button (arrow pointing to the right).
You may need to set some references to get to the different properties (such as tblFields). Here are the References I have on my database:
Visual Basic For Applications
Microsoft Access 9.0 Object Library (Access 2000)
Microsoft DAO 3.6 Object Library
OLE Automation
Microsoft Visual Basic for Applications Extensibility 5.3
Microsoft Office 9.0 Object Library
If you are not sure how to set these, you can enter the Microsoft Visual Basic editor (where you enter your code statements), then click on Tools. You can then click on References, then check your current list (they will have check marks in front of each one that is currently being utilized). Simply click on any missing references, and make sure they are in the order shown above.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.