falsepart of IIF is a wildcard in criteria expression

M

Mark

I need to make a criteria expression where if a control on
a form is not null then it's contents becomes the
criteria, but if it is null then there is no criteria.

I tried the following expression:

IIf([Forms]![frmFunding]![cboAgency],[Forms]![frmFunding]!
[cboAgency],"*")

However when the control is null the query results don't
contain any records, whereas it should display all of them
because then the criteria becomes a wildcard. I have tried
a number of variations for the wildcard but none of them
work.

How do I do this?

Thanks if you have an answer!!

Mark
Ontario, Canada
 
F

fredg

I need to make a criteria expression where if a control on
a form is not null then it's contents becomes the
criteria, but if it is null then there is no criteria.

I tried the following expression:

IIf([Forms]![frmFunding]![cboAgency],[Forms]![frmFunding]!
[cboAgency],"*")

However when the control is null the query results don't
contain any records, whereas it should display all of them
because then the criteria becomes a wildcard. I have tried
a number of variations for the wildcard but none of them
work.

How do I do this?

Thanks if you have an answer!!

Mark
Ontario, Canada

If you use a wildcard for parameter entry you must must use the LIKE
word.

Like IIf(IsNull(Forms]![frmFunding]![cboAgency]),"*",
[Forms]![frmFunding]! [cboAgency])
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top