Create a module and make a function or sub to set the query's sql property
equal to a string variable with the new sql statements:
Sub ChangeQuery()
Dim strSQL As String
Dim qdf As DAO.QueryDef
strSQL = "SELECT Field1 FROM Table1;"
Set qdf = CurrentDb.QueryDefs("qryTest")
qdf.SQL = strSQL
Set qdf = Nothing
End Sub