Hi,
One of the fields in my table is numeric and can have no value or a numeric value.
I also have a form where users can enter the criterium OR can leave that criterium-field empty.
In case they enter a numeric value, my query retrieves all the matching records. So far so good. (criterium =forms!critform!critfield)
But when they leave that criterium-field empty, I get no records. BUT I WANT ALL THE RECORDS, those with a numeric value but also those without a value.
With a text-field, I use the like "*" & forms!critform!critfield & "*" but this doesn't work with numeric fields.
When I test my query with the criterium Is Null or >0 I get all the records. So I know this works too.
But when I try the criterium Nz(forms!critform!critfield;Is Null or >0) I don't get any record. Changing it to Nz(forms!critform!critfield;"Is Null or >0") gives me an error.
How can I get the Is Null or >0 as criterium if the criteriumfield is left empty?
Thanks for helping!
Wim
One of the fields in my table is numeric and can have no value or a numeric value.
I also have a form where users can enter the criterium OR can leave that criterium-field empty.
In case they enter a numeric value, my query retrieves all the matching records. So far so good. (criterium =forms!critform!critfield)
But when they leave that criterium-field empty, I get no records. BUT I WANT ALL THE RECORDS, those with a numeric value but also those without a value.
With a text-field, I use the like "*" & forms!critform!critfield & "*" but this doesn't work with numeric fields.
When I test my query with the criterium Is Null or >0 I get all the records. So I know this works too.
But when I try the criterium Nz(forms!critform!critfield;Is Null or >0) I don't get any record. Changing it to Nz(forms!critform!critfield;"Is Null or >0") gives me an error.
How can I get the Is Null or >0 as criterium if the criteriumfield is left empty?
Thanks for helping!
Wim