Batch editing queries

  • Thread starter Thread starter John
  • Start date Start date
J

John

Hi

I need go through a large number of queries and do some intelligent
find/replace. Is there a way via vba code to traverse through all queries,
edit and then save?

Many Thanks

Regards
 
John said:
I need go through a large number of queries
and do some intelligent find/replace. Is there
a way via vba code to traverse through all
queries, edit and then save?

It's not a free solution, but I have had good luck with a third-party
product in all versions of Access in which I have used it, through Access
2003: Find and Replace from Rick Fisher Software, http://www.rickworld.com.

Larry Linson
Microsoft Office Access MVP



__________ Information from ESET Smart Security, version of virus signature database 4050 (20090503) __________

The message was checked by ESET Smart Security.

http://www.eset.com
 
Dim dbCurr As DAO.Database
Dim qdfCurr As DAO.QueryDef
Dim strSQL As String

Set dbCurr = CurrentDb()
For Each qdfCurr In dbCurr.QueryDefs
strSQL = qdfCurr.SQL
strSQL = Replace(strSQL, "Field1", "SomeOtherField")
strSQL = Replace(strSQL, "Table1", "SomeOtherTable")
qdfCurr.SQL = strSQL
Next qdfCurr
Set dbCurr = Nothing
 
Back
Top