dbTalk Databases Forums  

Globally replace table name in access queries

comp.databases.ms-access comp.databases.ms-access


Discuss Globally replace table name in access queries in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Peter Clements
 
Posts: n/a

Default Globally replace table name in access queries - 11-19-2010 , 04:56 AM






Hi,
I need to change a table name referenced in > 100 queries. The queries did not pick up the rename of the table. Is there an easy way to do this ?

Thanks

Peter Clements

Reply With Quote
  #2  
Old   
chrisdev
 
Posts: n/a

Default Re: Globally replace table name in access queries - 11-19-2010 , 05:43 AM






Hi,

you can loop through all queries

For i = db.QueryDefs.Count - 1 To 0 Step -1
If instr(db.QueryDefs(i).SQL, tablename) >0 Then
'update query SQL by replacing old table name, you can create a
loop for replacing name in case more than once is found
db.QueryDefs(i).SQL =
End If
Next i

Chris

Reply With Quote
  #3  
Old   
agiamb
 
Posts: n/a

Default Re: Globally replace table name in access queries - 11-19-2010 , 07:06 AM



http://www.rickworld.com/

--

AG
Email: npATadhdataDOTcom


"Peter Clements" <user (AT) compgroups (DOT) net/> wrote

Quote:
Hi,
I need to change a table name referenced in > 100 queries. The queries did
not pick up the rename of the table. Is there an easy way to do this ?

Thanks

Peter Clements



Reply With Quote
  #4  
Old   
(PeteCresswell)
 
Posts: n/a

Default Re: Globally replace table name in access queries - 11-19-2010 , 08:39 AM



Per agiamb:
Quote:
http://www.rickworld.com/
+1

I've tried a commercial-grade replace utility and it didn't hold
a candle to the RickWorld offering - in speed or convenience.
--
PeteCresswell

Reply With Quote
  #5  
Old   
bobh
 
Posts: n/a

Default Re: Globally replace table name in access queries - 11-19-2010 , 12:33 PM



On Nov 19, 5:56*am, Peter Clements <u... (AT) compgroups (DOT) net/> wrote:
Quote:
Hi,
I need to change a table name referenced in > 100 queries. The queries did not pick up the rename of the table. Is there an easy way to do this ?

Thanks

Peter Clements
I use Find&Replace as mentioned by Agiamb and Peter

Reply With Quote
  #6  
Old   
Bob Barrows
 
Posts: n/a

Default Re: Globally replace table name in access queries - 11-19-2010 , 03:13 PM



Peter Clements wrote:
Quote:
Hi,
I need to change a table name referenced in > 100 queries. The
queries did not pick up the rename of the table. Is there an easy way
to do this ?

Thanks

Peter Clements
Create a saved query using the original name of the table and have it select
from the renamed table

Reply With Quote
  #7  
Old   
Tony Toews
 
Posts: n/a

Default Re: Globally replace table name in access queries - 11-19-2010 , 03:16 PM



On Fri, 19 Nov 2010 08:06:21 -0500, "agiamb"
<NOSPAMagiamb (AT) newsgroup (DOT) nospam> wrote:

Quote:
http://www.rickworld.com/
Fine product!

Tony
--
Tony Toews, Microsoft Access MVP
Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
For a convenient utility to keep your users FEs and other files
updated see http://www.autofeupdater.com/

Reply With Quote
  #8  
Old   
David-W-Fenton
 
Posts: n/a

Default Re: Globally replace table name in access queries - 11-21-2010 , 02:18 PM



"(PeteCresswell)" <x@y.Invalid> wrote in
news:d03de61n9nsi77k44dk320gpkc1r26gp4j (AT) 4ax (DOT) com:

Quote:
Per agiamb:
http://www.rickworld.com/

+1

I've tried a commercial-grade replace utility and it didn't hold
a candle to the RickWorld offering - in speed or convenience.
I own Rick Fisher's tool, but don't think it comes close to
SpeedFerret, which I used to use quite extensively with A97 (I never
upgraded because by the time I have moved away from A97, the target
was A2003, and SpeedFerret was never upgraded for that,
unfortunately).

The tools that I actually use more than Rick's are:

1. Name Autocorrect -- I kid you not. Keep it off for normal work,
but when you need to do a major renaming, turn it on temporarily,
and turn it back off when you're finished. It works fine if used in
this way.

2. MDBSearch 2.1 (by Ucora and Jamie Bernstein) -- this is no longer
available anywhere on the Internet so far as I can tell, but it's
what I use more because it works very well for what it does.

--
David W. Fenton http://www.dfenton.com/
contact via website only http://www.dfenton.com/DFA/

Reply With Quote
  #9  
Old   
Tony Toews
 
Posts: n/a

Default Re: Globally replace table name in access queries - 11-21-2010 , 07:27 PM



On 21 Nov 2010 20:18:20 GMT, "David-W-Fenton" <dfassoc (AT) dfenton (DOT) com>
wrote:

Quote:
1. Name Autocorrect -- I kid you not. Keep it off for normal work,
but when you need to do a major renaming, turn it on temporarily,
and turn it back off when you're finished. It works fine if used in
this way.
I will occasionally do the same.

Tony
--
Tony Toews, Microsoft Access MVP
Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
For a convenient utility to keep your users FEs and other files
updated see http://www.autofeupdater.com/

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.