Find and replace table name

jpl458

Well-known member
Local time
Today, 09:19
Joined
Mar 30, 2012
Messages
1,198
I have an app the extensively uses the name of a table. I want to change the name of that table wherever it appears in the app. I have made a back up of the app, but when I go into Find and Replace in the code window it only works on the form that is open. Is there a way to change it everywhere in the app?
 
but when I go into Find and Replace in the code window it only works on the form that is open.
Did you select current project in the find window?
 
select current project

find1.PNG


MZ Tools has a better one

find2.PNG
 
Yes, and then Find Next get grayed out.
 
Yes, and then Find Next get grayed out.
Selected Current Project but it says it cant fined what I am looking for. Its the name of a table that I want to change.

1668698956660.png


1668699040173.png


I'm no expert in ACCESS, but it seems to me that you should be able to change something everywhere in the project. I can do that in Python IDE.
 
Absolutely sure. The name I want to change appears in queries and as the Record Source in several forms. Do I need to get a 3rd party somthing-or-other to do a global change to a project? But I think we talked about this and you told me to make sure I had a backup before doing it. That led me to believe that you had done the same thing at some time or other. I do it in the code window, but that only shows the code for the open form in design mode. Am I doing something wrong here? Else, I make the change and do regression testing and make all the changes by hand. That really sucks.

Just added this after thinking. If it works, would it change the name in the SQL for queries?
 
Last edited:
The short answer is no - you need a third party add-in like V-Tools

It goes through all the table defs, query defs, and code and finds all the instances of the search string.
 
Simple way: Create a query and name it OldTableName.
Code:
SELECT * FROM NewTableName

A little more comprehensive, but without claiming a third-party solution: Export your objects with SaveAsText. Text files are created with the complete definitions. In these text files you can replace the table name. Then the object definitions are re-imported with LoadFromText.
 
The name I want to change appears in queries and as the Record Source in several forms.
if you have autocorrect turned on, changing the name of a table or table field will change it in other objects (queries, forms and reports) providing a) they are closed at the time and b) you have autocorrect turned on. You use find and replace in code as you have already tried

The only exception I can think of is it won't change it in subqueries

However I see Pat has provided a more detailed response
 
When I saw the title of the topic, I was interested because I thought it was possible to do such an action directly.
However, I didn't know about such tool as V tool. Thank you for sharing!
 

Users who are viewing this thread

Back
Top Bottom