INTELLIGENT WORK FORUMS FOR COMPUTER PROFESSIONALS
Come Join Us!
Are you a Computer / IT professional? Join Tek-Tips now!
- Talk With Other Members
- Be Notified Of Responses
To Your Posts
- Keyword Search
- One-Click Access To Your
Favorite Forums
- Automated Signatures
On Your Posts
- Best Of All, It's Free!
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.
Partner With Us!
"Best Of Breed" Forums Add Stickiness To Your Site

(Download This Button Today!)
Feedback
"...Your site has saved me hours of work that I cannot begin to express my satisfaction..."
Geography
Where in the world do Tek-Tips members come from?
|
Microsoft: Access Forms FAQ
|
How to
|
Print table and field names into Immediate window
Posted: 6 Dec 02 (Edited 24 Mar 03)
|
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.
|
Back to Microsoft: Access Forms FAQ Index
Back to Microsoft: Access Forms Forum |
|
 |
|
Join Tek-Tips® Today!
Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.
Here's Why Members Love Tek-Tips Forums:
Talk To Other Members
- Notification Of Responses To Questions
- Favorite Forums One Click Access
- Keyword Search Of All Posts, And More...
Register now while it's still free!
Already a member? Close this window and log in.
Join Us Close