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 MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update a query based on a changed table name

Status
Not open for further replies.

jappe22

Technical User
Sep 25, 2006
9
NL

I changed a table name from tblOp-Type to tblOpType.

Now, off course all the queries don't work anymore, because they can't find the table tblOp-Type

What is an easy way to update all the queries to direct to the new name?

Jasper
 
Code:
Dim tdf As DAO.Tabledef
For Each tdf in CurrentDb.Tabledefs
   If Instr(1, tdf.SQL, "tblOp-Type") > 0 Then
      tdf.SQL = Replace(tdf.SQL, "tblOp-Type", "tblOpType")
   End If
Next
 
Golom, I guess you meant QueryDef instead of TableDef ?
 
Another quick way would be to create a query; select all fields in the new table and name it (the query) tblOp-Type.
All queries would work just fine.

Greg
"Personally, I am always ready to learn, although I do not always like being taught." - Winston Churchill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top