Using Option Group for Criteria of query

G

Guest

I have a userform with a 2 option button's in a Groupbox. I would like to use
these as the criteria of a query if possiable. The option buttons value's are
1 and 2.
So I thought I could say............In the Criteria of TENDER_TYPE
IIf([Forms]![PDetail_Form]![Frame_Coupons]=1,([TENDSALE].[TENDER_TYPE])<500,([TENDSALE].[TENDER_TYPE])>=500)
but this returns nothing in the query. Am I missing something?

Thanks Mike
 
M

Marshall Barton

Mike said:
I have a userform with a 2 option button's in a Groupbox. I would like to use
these as the criteria of a query if possiable. The option buttons value's are
1 and 2.
So I thought I could say............In the Criteria of TENDER_TYPE
IIf([Forms]![PDetail_Form]![Frame_Coupons]=1,([TENDSALE].[TENDER_TYPE])<500,([TENDSALE].[TENDER_TYPE])>=500)
but this returns nothing in the query. Am I missing something?


The Criteria in the query design grid is compared to the
field, so you end up comparing TENDER_TYPE to True of False,
which is probably menaingless.

Try using your expression as a calculated field in the Field
row and setting its Criteria to True
 
J

John Spencer

You can use something which is not efficient since it cannot use any indexes
and must do a calculationi for every row and cannot be used other than in
Access
Field:
IIf([Forms]![PDetail_Form]![Frame_Coupons]=1,([TENDSALE].[TENDER_TYPE])<500,([TENDSALE].[TENDER_TYPE])>=500)
Criteria: <> False

Note that the IIF expression is entered in a field "box" and the criteria
under the expression is entered as <> false

--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..

Marshall Barton said:
Mike said:
I have a userform with a 2 option button's in a Groupbox. I would like to
use
these as the criteria of a query if possiable. The option buttons value's
are
1 and 2.
So I thought I could say............In the Criteria of TENDER_TYPE
IIf([Forms]![PDetail_Form]![Frame_Coupons]=1,([TENDSALE].[TENDER_TYPE])<500,([TENDSALE].[TENDER_TYPE])>=500)
but this returns nothing in the query. Am I missing something?


The Criteria in the query design grid is compared to the
field, so you end up comparing TENDER_TYPE to True of False,
which is probably menaingless.

Try using your expression as a calculated field in the Field
row and setting its Criteria to True
 

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