Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to change a Query Name throughout the database

Status
Not open for further replies.

sawilliams

Technical User
Aug 23, 2006
98
US
If I have named a query something like Query1 and used that query in other queries, is there a way of renaming the original Query1 to something that makes more sense and have it update wherever that query is used. So, for example, if I rename Query1 to be qryCustomer, is there a way of automatically fixing it wherever it might have been used?
 
If you are talking about VBA, use the Find and Replace function.

Beir bua agus beannacht!
 
Oops, not a function, a utility...

Beir bua agus beannacht!
 
No, I'm just working in queries in the database window. If I rename the first query and then run a query that looks at that one, of course, I get an error that it can't find the original query. So, then I have to rebuild the 2nd query by adding in the newly named one. It just seems like there ought to be some way to globally update something like a query name if it has been modified.
 
Maybe have a look at the QueryDefs collection in VBA. Don't use it much, but you might discover a way to enumeraste the collection and change the definition...

Beir bua agus beannacht!
 
Good suggestions. Thanks. And that list of scan and replace utilities is great.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top