Try this on a copy of your dB.
I say again: Try this on a COPY of your dB.
Code:
Public Sub ExportLookaheads()
Const sTableOldName As String = "tblPrem"
Const sTableNewName As String = "tblPremFinal"
Dim qdf As QueryDef
Dim tmpSQL As String
'loop through Query Collection
For Each qdf In CurrentDb.QueryDefs
tmpSQL = vbNullString 'clear variable
If Left(qdf.Name, 1) <> "~" Then 'ensure the query is not deleted
tmpSQL = qdf.SQL 'get query SQL
'check to see if the SQL contains sTableOldName but not sTableNewName
If InStr(1, tmpSQL, sTableOldName) And Not InStr(1, tmpSQL, sTableNewName) Then
tmpSQL = Replace(tmpSQL, sTableOldName, sTableNewName)
qdf.SQL = tmpSQL 'save the modified SQL
Debug.Print qdf.Name & " -- " & tmpSQL 'print changed SQL to immediate window
End If
End If
Next qdf
Set qdf = Nothing
End Sub
I did say to try this on a copy of your dB.... didn't I??????
Good luck