problem with criteria in queries (1 Viewer)

bauer

Registered User.
Local time
Yesterday, 19:50
Joined
Aug 23, 2001
Messages
77
alright, I have a bit of a problem. I've been writting a few queries of mine through VBA b/c of a wealth of criteria, however for the sake of clarity, as well as the users requesting the quesries themselves, I want to use expressions in the criteria of the query.

Now, here's what I'm trying to do.
on my form that opens the query (which really is the source for several reports) I have about 9 different criteria, each of them are enabled by a check box. In other words, if the checkbox is checked the criteria box is enabled. Now each of those checkboxes has either a combo box filled from a query that relates to a field in the query, or there are option buttons in a frame for yes/no field types.

And finally, here's my problem. In the criteria section of a particular field, I have this iif statement for a yes/no:
IIf([forms]![viewreports]![chkaddress],IIf([forms]![viewreports]![frameaddress]=1,"yes"))
where frameaddress is the option button in the frame
and this for a combo box:
IIf([forms]![viewreports]![chkaddresstype],[[forms]![viewreports]![addresstype],)
SO, now when the check box is selected, I have no problem, however, if it's not, I get nothing showing up(which there should be something showing up.

either that or I sometimes get an error of it's too complex.

Thanks anyone for your response.

-Bauer
 

boblarson

Smeghead
Local time
Yesterday, 16:50
Joined
Jan 12, 2001
Messages
32,059
bauer wrote:
>>and this for a combo box: IIf([forms]![viewreports]![chkaddresstype],[[forms]![viewreports]![addresstype],)<<

First thing I notice is that you are missing an operand. You are asking for the formula to evaluate an expression, but you don't have one. There is no If x = y then do this if true or this if false. It currently reads as: If x true.

So change it to read:
IIf([forms]![viewreports]![chkaddresstype]=SOMETHING,[forms]![viewreports]![addresstype],)

BL
hth

[This message has been edited by boblarson (edited 12-20-2001).]
 

bauer

Registered User.
Local time
Yesterday, 19:50
Joined
Aug 23, 2001
Messages
77
Well, I tried putting in chkaddress=-1 and I tried =1 b/c I'm checking if the check box chkaddress is checked (that's why I was trying to evalute it if it was true), however, now I'm getting an empty resultset, when I know for a fact there shoulc be something there, b/c I get this result regardless of if I have the checkbox checked or not.

thank you again
 

Users who are viewing this thread

Top Bottom