Filtering Records with a Form

  • Thread starter Thread starter David
  • Start date Start date
D

David

I am using the following syntax in the field criteria
within a query:

IIf([Forms]![FormName]![FormControl] Is Null,"",[Forms]!
[FormName]![FormControl])

I want to filter the records if the control is not null,
and return all records if the control is null. What is
happening is that if the control is not null, it filters
correctly, but if the control is null, no records are
returned.

Can someone tell me what I am doing wrong?

Thanks for your help in advance.
 
The way you have it written it is looking for an empty
string in that field "".

Try this:

IIf([Forms]![FormName]![FormControl] Is Null,[myTable]!
[myField],[Forms]![FormName]![FormControl])

Instead of "" for the true condition use
!
[fieldname] using a field that has all possible criteria
for your query.

HTH
 
Back
Top