?
Solved

Script to read table Def

Posted on 2011-09-11
6
Medium Priority
?
304 Views
Last Modified: 2012-05-12
Hi Experts

Does any one know how to do a script (or has one) that will loop through every field of a given table and retrieve its field name, type and size?

by size, i mean:
  - if type text, size = 15
  - if type = number, size = long
   - if type = yes/no, size = true/false

etc...

Ideally, i'd store this info in a 4-field table (table, name, type, size), and use in a report to print and document.,

Any help will be appreciated
0
Comment
Question by:APD_Toronto
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 46

Accepted Solution

by:
aikimark earned 2000 total points
ID: 36520443
Dim td As DAO.Tabledef
Dim fld As DAO.Field
For Each fld In DbEngine(0)(0).TableDefs("MyTablename").Fields
  Debug.Print fld.Name, fld.Type, fld.Size 
Next

Open in new window

0
 
LVL 77

Expert Comment

by:peter57r
ID: 36521271
You appear to be duplicating what is already available in the database documentor tool
0
 

Author Comment

by:APD_Toronto
ID: 36523249
alkimark, where can I get what the type #s are?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 46

Expert Comment

by:aikimark
ID: 36523426
open up your immediate window and type
?DataTypeEnum.

Open in new window


When you type the period, you should see, courtesy of intellisense, a list of the enum names and values for database field type.

0
 
LVL 31

Expert Comment

by:Helen Feddema
ID: 36523510
For a somewhat more elegant report on fields, see my Extras Plus add-in (http://www.helenfeddema.com/Files/code20.zip), a free download from my Website.  One of its menu add-ins creates a nicely formatted report listing all fields in all tables in the current database, either alphabetically or by order in the table:

Table-Fields-Report.jpg
0
 
LVL 75
ID: 36524331
Allen Browne has a good list here:

http://allenbrowne.com/func-06.html

mx
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question