Query Criteria part 2

J

Jasper Recto

I have form that ask for a date and a button that runs a query based on that
date.

On that form there is a check box. If that check box is checked than I want
the query to filter all records that have a 'MA' under their group. BUT, if
the check box is NOT checked, I want the query to run regardless of their
group.


In my querey, the group criteria says this:

IIf([Forms]![frmVendorMenu]![Check13]=-1,'MA',([Forms]![frmVendorMenu]![Check13]
Is Null))

This works if the check box is checked but if it not checked I get this
error:

"This expression is typed incorrectly, or it is too complex to be
evaluated."

Any ideas?

Thanks,
Jasper
 
S

Steve Schapel

Jasper,

Do it like this instead...

In the Field row of a blank column in the query design grid, enter this:
[Forms]![frmVendorMenu]![Check13]

In the first criteria row, enter this in the Group column:
"MA"
.... and this in the [Forms]![frmVendorMenu]![Check13] column:
<>0

In the second criteria row, leave the Group column blank, and enter this
in the [Forms]![frmVendorMenu]![Check13] column:
0
 
J

Jasper Recto

THANKS Steve, It worked great!


Steve Schapel said:
Jasper,

Do it like this instead...

In the Field row of a blank column in the query design grid, enter this:
[Forms]![frmVendorMenu]![Check13]

In the first criteria row, enter this in the Group column:
"MA"
... and this in the [Forms]![frmVendorMenu]![Check13] column:
<>0

In the second criteria row, leave the Group column blank, and enter this
in the [Forms]![frmVendorMenu]![Check13] column:
0

--
Steve Schapel, Microsoft Access MVP

Jasper said:
I have form that ask for a date and a button that runs a query based on
that date.

On that form there is a check box. If that check box is checked than I
want the query to filter all records that have a 'MA' under their group.
BUT, if the check box is NOT checked, I want the query to run regardless
of their group.


In my querey, the group criteria says this:

IIf([Forms]![frmVendorMenu]![Check13]=-1,'MA',([Forms]![frmVendorMenu]![Check13]
Is Null))

This works if the check box is checked but if it not checked I get this
error:

"This expression is typed incorrectly, or it is too complex to be
evaluated."

Any ideas?

Thanks,
Jasper
 

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