The answer depends on how flexible you need the query to be for production use. If the number to test against changes, then you'll want to use VBA to define a query as needed.
I'm making an assumption that you're probably using something like a form and asking users to type in a value then hitting a command button to show your query.
Inserting this into the _Click() event...
Call MakeQry(Forms!formName.controlName)
DoCmd.OpenQuery qryName, acReadOnly
Function MakeQry(ByVal qryname As String, ByVal yourvalue As Long)
Dim dbs As DAO.Database
Dim strSQL As String
Set dbs=CurrentDB()
strSQL = "SELECT * FROM tbl1 WHERE tbl1.fld1 > " & yourvalue & ";"
DoCmd.DeleteObject acQuery,qryName
Set qdf = dbs.CreateQueryDef(qryName,strSQL)
Set dbs = Nothing
End Function
This actually defines the query.
A simpler approach would be to avoid the need to delete/define a query
and use DoCmd.RunSQL
Function MakeQry(ByVal qryname As String, ByVal yourvalue As Long)
Dim dbs As DAO.Database
Dim strSQL As String
Set dbs=CurrentDB()
strSQL = "SELECT * FROM tbl1 WHERE tbl1.fld1 > " & yourvalue & ";"
DoCmd.RunSQL strSQL
Set dbs = Nothing
End Function
The difference is, your needs. Do you need to use the query elsewhere?
Mike