Sub NewQuery()
Dim dbs As Database, qdf As QueryDef, strSQL As String
' Return reference to current database.
Set dbs = CurrentDb
strSQL = "SELECT * FROM Employees WHERE [HireDate] >= #1-1-93#"
' Create new query.
Set qdf = dbs.CreateQueryDef("RecentHires", strSQL)
DoCmd.OpenQuery qdf.Name
Set dbs = Nothing
End Sub