Updating Field name for all tables/queries

  • Thread starter Thread starter Steve
  • Start date Start date
S

Steve

Hi,

I need to change the name of my Primary key field
throughout the whole of my database.

How do I use Tabldef and QueryDef to edit this field from
VBA? (access97)

I want to change it from PAS_Ref to Workflow_Ref.

Any help would be appreciated.

Cheers,
Steve.
 
first you have to drop primary key
then open tabledef of this table
rename:
tdf.Fields("PAS_Ref").NAME = "Workflow_Ref"

then create primary key again
HTH
 
Alex,

Thanks for the reply.

How would I loop this throughout all Tabledefs and
Querydefs?

I have about 25 tables to update and i dont know how many
queries, thats why im looking for the 'lazy' way :)

Cheers,
Steve.
 
Thanks for the replies, but I am unable to d/l or install
apps at work.

I can update my modules and forms easily enough, its just
the tables and queries which will be the most labourious.

Is it not possible to change this field name via code?

Cheers,
Steve.
 
Back
Top