Paramater Query Show All if Left Blank

fenhow

Registered User.
Local time
Today, 15:29
Joined
Jul 21, 2004
Messages
599
Hi, I have this in a parameter query. The Query calls the begin date and end date from a form. If the user leaves the fields blank on the form I would like all records to show but cannot figure out how to do it.
Can anyone help?

Between [Forms]![frm_ParameterForm]![txtBeginDate] And [Forms]![frm_ParameterForm]![txtEndDate]

Thanks so much.
Fen
 
For dates I'd use Nz() around each, like:

Nz([Forms]![frm_ParameterForm]![txtEndDate], #12/31/2029#)
 
Between IIF(Trim([Forms]![frm_ParameterForm]![txtBeginDate] & "")="", yourDateField, [Forms]![frm_ParameterForm]![txtBeginDate]) And IIF(Trim([Forms]![frm_ParameterForm]![txtEndDate] & "")="", yourDateField,
[Forms]![frm_ParameterForm]![txtEndDate])
 
Thank you, on the Nz with the ,12/31/2029 in it. Can you explain the 12/31/2029?
Fen
 
For each textbox, you're substituting dates before/after anything that would exist in the data. For the from date I might use 1/1/1980, but you'd use a date appropriate to your data.
 

Users who are viewing this thread

Back
Top Bottom