Sub FindReplaceAllQueries()
'Loops through all queries in this Access file and does a find/replace
'based on the variables sFindWhat and sReplaceWith
Dim sFindWhat As String, sReplaceWith As String
Dim qryDef As QueryDef
sFindWhat = "LAWAPP8DB"
sReplaceWith = "LAWAPP9DB"
For Each qryDef In CurrentDb.QueryDefs
qryDef.SQL = Replace(qryDef.SQL, sFindWhat, sReplaceWith)
Next
MsgBox "All Done"
End Sub