Setting All Fields In All Tables

DALIEN51

Registered User.
Local time
Today, 08:35
Joined
Feb 26, 2004
Messages
77
I have an Access 2000 database with several tables in it. Against each field in each table I would like to set every REQUIRED and INDEXED value to NO. Is there a way I can do this using VBA?

If it helps, one of the tables has 2 fields in it named TABLE NAME and FIELD NAME with every field against every table listed.

Any help most appreciated.

Dalien51
 
To do this using VBA, you need to do just a little research and you need to know a few things about Access structure.

1. All tables are members of a COLLECTION called TABLEDEFS.

2. Each member (table) is a TABLEDEF (no S)

3. The fields in each table are part of a collection called FIELDDEFS.

4. Each member (field) is a FIELDDEF (no S)

5. The properties you name are accessible through a syntax something like

TableDefs(n).Fielddefs(m).Required (or .... .Indexed)

Look up "Collections" in Help to see how to properly navigate them using VBA. To do what you want should be a simple nested loop.

BEWARE: If you find a system table (tabledef property "hidden" will be set, name will begin with msys_), DON'T TOUCH IT. Otherwise, your database will go BANG ZOOM.
 

Users who are viewing this thread

Back
Top Bottom