Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Option Group and Paramater on Form

Status
Not open for further replies.

blackduck

Programmer
Jun 11, 2002
119
AU
Have main form with subform. Main form has combo to filter by department. I want to also add an option group with three optins: (relating to the subform filter)
* all records (ie no further filter)
* field b checkbox ticked as being finished
* field c checkbox ticked as being finished
Have query in subform and want to have a parameter saying in field b IIf([fraCheck]=2,is null,).
in field c IIf([fraCheck]=3,is null,).
 
Hi,

I can't really understand what you're trying to do or what the problem is, but an IIF statement needs three parts - a test, an action for a true result (The THEN in a standard IF statement), and an action for a false result (The ELSE in a standard IF statement).

Your statement:
Code:
IIf([fraCheck]=2,is null,)

is missing the false part, or the ELSE. It should be something like: (Purely as an example)

Code:
IIf([fraCheck]=2,is null,"*")

JB

 
Yes i am having trouble with the else. I want it to be Else do nothing.
In the table the Data type is yes/no.
On my form it is a checkbox.

If i enter the parameter value as 2 it works, otherwise I get the following error:
This expression is typed incorrectly, or it is too complex to be evaluated. For example, a numeric expression may contain too many complicated elements. Try simplifying the expression by assigning parts of the expression to variables. (Error 3071)
 
Have you looked at the TripleState of a checkbox? You'll see that option of the property sheet of the checkbox, option button, or toggle button.
A triplestate checkbox can have the three values of True/Yes/On (-1), False/No/Off (0) and grayed out (Null state).
After a selection is made in the check box, the user can then use the Run Query command to run a CASE statement.
The Case statement runs the query dependant on the value returned from the Check box.
In the Triple State property this can be either Yes(-1), No(0) or Null.
So you could have a checkbox where if checked(Yes) then B, if not checked(No) then C, if Null then ALL.

Private Sub cmdRunQuery_Click()
Select Case Me!chkActivity

Case Is = -1
' Filter for 'Active' returns -1
DoCmd.OpenQuery "qryFind_Active_Inactive"
Case Is = 0
' Filter for 'Inactive' returns 0
DoCmd.OpenQuery "qryFind_Active_Inactive"
Case Else
' instance where All values need to be returned
DoCmd.OpenQuery "qryFind_Active_Inactive"
End Select

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top