How do I change a field name in a query without breaking everything else that uses it

Access9001

Registered User.
Local time
Today, 10:00
Joined
Feb 18, 2010
Messages
268
I have a query with a field labeled OldName. I want to rename it to NewName.

However, when I do this, other queries that either have joins/relationships/whatever you call them on OldName break because they can't find OldName after the renaming.
 
I think access has a track changes option so that if you change a name it changes it elsewhere. I haven't used that though as it slows down the application and may change things when you don't intend to. Instead I use Find And Replace, it is around $40, but it does a lot of things, can find and replace information and names in queries, tables, reports, macros, modules, forms. They offer a free trial. http://www.rickworld.com/

Alternatively, if you know which queries have the name to be changed, you could open them up in SQL view and edit the text of the sql statement to change the name.
 
NameAutoCorrect will track the changes in queries and most of the references in forms and reports. However does not fix references in code or SQL string RecordSources.

Moreover NAC can corrupt objects especially if the new name is already used elswhere in in the database. I have seen it go wrong if a field is given the same name as another table.

V-Tools has a Find And Replace facilty (Deep Search) that handles objects and code. It is a fantastic free suite of tools.
 

Users who are viewing this thread

Back
Top Bottom