I have been programming a query based on a form with each field having an 'active' tick box and a data entry, hopefully giving the user a fairly flexible interface to make queries from, but the following code is perplexing me:
Like IIf([criteria.notesactive]=-1,[criteria.notes],"*")
This code basically checks the form to see if the field is active (using the check box) and if so then searches for the criteria specified, otherwise it should find all records, ie. "*"
BUT
It doesn't find blank field entries. If I go back to basics and put a non-interactive criteria in, the following applies:
"*" - gives all records excluding blanks
is null - gives all blank records
"*" or is null - gives all records including blanks
I can't seem to incorporate the "*" or is null into the Like statement above, does anyone know the correct layout for the statement.
ALSO
This statement was for text fields, I also have a couple of number fields, which seem to cause an additional problem of not using the null or like entry, so I use this formula:
>=IIf([criteria.mincashactive]=-1,[criteria.mincash],0)
But I couldn't think of the correct syntax for 'all' numbers, like "*" is used on text, that's why I've tried putting a '0'.
So there it is, two combinations of Iif statements on text and numbers, but I need to find selected or ALL records.
Thankyou if you've got an answer!!!
Like IIf([criteria.notesactive]=-1,[criteria.notes],"*")
This code basically checks the form to see if the field is active (using the check box) and if so then searches for the criteria specified, otherwise it should find all records, ie. "*"
BUT
It doesn't find blank field entries. If I go back to basics and put a non-interactive criteria in, the following applies:
"*" - gives all records excluding blanks
is null - gives all blank records
"*" or is null - gives all records including blanks
I can't seem to incorporate the "*" or is null into the Like statement above, does anyone know the correct layout for the statement.
ALSO
This statement was for text fields, I also have a couple of number fields, which seem to cause an additional problem of not using the null or like entry, so I use this formula:
>=IIf([criteria.mincashactive]=-1,[criteria.mincash],0)
But I couldn't think of the correct syntax for 'all' numbers, like "*" is used on text, that's why I've tried putting a '0'.
So there it is, two combinations of Iif statements on text and numbers, but I need to find selected or ALL records.
Thankyou if you've got an answer!!!