It can't be done using a parameter query as you have it set up. If you have
two parameters, you are going to get prompted twice.
You could do it with a form and some controls on the form that the query
would reference. Or you could try the following. Warning: Access will
rewrite this when you save/close the query.
Field: YourDateField
Criteria: >= [Enter Start Date] OR [Enter Start Date] is null
<<Add a second reference to the field>>
Field: YourDateField
Criteria: <= [Enter End Date] OR [Enter End Date] is Null
Of course, if your date field ALWAYS has a value then you can use the first
technique I mentioned on both parameters forcing a date in the past that is
earlier than any date in your records and a date in the future that is later
than any date in your records.
Field: YourDateField
Criteria: Between NZ([Enter Start Date (dd/mm/yy):],#1/1/1899#)
And NZ( [Enter End Date (d/m/yy) Blank for
All:],#1/1/9999#)
IF you really want you can even use NZ on your date field and return a
non-null date value. Of course, this means all your queries will run slower
since any index on your date field will not be useable in selecting
records.
Field: ForceDate: Nx(YourDateField,#1/1/9999#)
Criteria: Between NZ([Enter Start Date (dd/mm/yy):],#1/1/1899#)
And NZ( [Enter End Date (d/m/yy) Blank for
All:],#1/1/9999#)
Scott said:
John,
Thanks for your reply. Yes, enter return once to show all records. In
addition, to disable the second input as the 2nd input becomes
unnecessary.
Scott
John Spencer said:
Do you mean you want to show all records after the start date? You could
use the NZ function to force some date far in the future.
Between [Enter Start Date (dd/mm/yy):] And NZ( [Enter End Date (d/m/yy)
Blank for All:],#1/1/9999#)
Scott said:
I have a parameter query, "Between [Enter Start Date (dd/mm/yy):] And
[Enter End Date (dd/mm/yy):]". If I want to show all records, how can I
disable the 2nd input.
Thanks,
Scott