babble324
asked on
Query a date range in access database
Hi,
I have a listbox that has a row source of a query of a table.
In my query, I filter with a date range.
In the criteria field for the "Date"
Between NZ([From],#1/1/1900#) And Nz([To],#12/31/9999#)
Now, this works perfect. Only problem I realized is that some of my records don't have a date, i.e. is null. How do I modify the criteria expression to also accept Null dates.
Thanks in advance,
I have a listbox that has a row source of a query of a table.
In my query, I filter with a date range.
In the criteria field for the "Date"
Between NZ([From],#1/1/1900#) And Nz([To],#12/31/9999#)
Now, this works perfect. Only problem I realized is that some of my records don't have a date, i.e. is null. How do I modify the criteria expression to also accept Null dates.
Thanks in advance,
ASKER
The null issue is not tied to the field, I am referring to my actual record. Some of my records don't have any dates. Date value is null. I would like them to be included in the query; even though they don't have a date.
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
I agree with the above, the only consideration then will be where the dates will end up if they are null with regard to the ordering hence my suggestion of IIF
iif ([From] is null, "Todays Date", [From])
Please excuse my pseudo code above as I have not used access in a number of years.
I hope this points you to a solution.