Optional record selection based on form's checkbox

K

Kathy Webster

I have a query with a [PaymentAmount] field.

When the query runs, it should check the value in the checkbox of
[forms]![ExcelExport]![txt100k], and if the value is False, the query should
select records whose [PaymentAmount] is <100,000.
If the value in the checkbox of
[forms]![ExcelExport]![txt100k] is True, it should select records whose
[PaymentAmount] is >=100,000.

I put the following in the criteria of the query grid under [PaymentType]:
IIf([forms]![ExcelExport]![txt100k]=False,<100000,>=100000)

I'm not getting any matches, either way, and there are plenty.

This seems like it should be a slam dunk, but so far its only been a
slam...
 
J

John Vinson

I have a query with a [PaymentAmount] field.

When the query runs, it should check the value in the checkbox of
[forms]![ExcelExport]![txt100k], and if the value is False, the query should
select records whose [PaymentAmount] is <100,000.
If the value in the checkbox of
[forms]![ExcelExport]![txt100k] is True, it should select records whose
[PaymentAmount] is >=100,000.

I put the following in the criteria of the query grid under [PaymentType]:
IIf([forms]![ExcelExport]![txt100k]=False,<100000,>=100000)

I'm not getting any matches, either way, and there are plenty.

This seems like it should be a slam dunk, but so far its only been a
slam...
You can't pass an OPERATOR such as < or >= in a parameter or function
call - only a value.

Try instead editing your query's SQL to include

(([Forms]![ExcelExport]![txt100K] AND [PaymentAmount] >= 100000) OR
([Forms]![ExcelExport]![txt100K] = False AND [PaymentAmount] <
100000))


John W. Vinson[MVP]
 

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