Well, you really haven't given enough info to give a good answer.
What are you using the query for?
Is it the record source for a form? A report?
Is the query a saved query?
Could it be a query in code?
If the query is for a form record source, you could use code to set a filter.
If a saved query, you could use code to modify the saved query SQL. This would change the SQL of the query - until you changed it again.
Example:
Say you have a saved query ("qry1") with SQL of
Code:
SELECT MyDate FROM MyTable
. You execute the query and it returns all records.
Now you have a form where some how you have a way to pick different options to filter the date field and you select "Is Not NULL".
You run code so that now the SQL for the query is changed to:
Code:
SELECT MyDate FROM MyTable WHERE MyDate Is Not NULL
Every time you execute the query "qry1", the criteria is "Is Not NULL" until you run the code to change the criteria to something different.
Here is an example of modifying the query SQL:
Code:
Sub RewriteQuerySQL(strQueryName As String, strParameter As String)
Dim db As DAO.Database
Dim qdf As DAO.QueryDef
Set db = CurrentDb()
Set qdf = db.QueryDefs(strQueryName)
qdf.SQL = "SELECT [Table].Field1, [Table].Field2 " & vbCrLf & _
"FROM [Table] " & vbCrLf & _
"WHERE ([Table].Field1 = " & chr(34) & strParameter & chr(34) & ");"
Set qdf = Nothing
Set db = Nothing
End Sub