Option group criteria not working

vmon

Registered User.
Local time
Today, 11:44
Joined
Jan 21, 2003
Messages
49
I have an option group on a form that us used as criteria for a query. There are 3 options in the group. The field being filtered is a yes/no. Below is my statement. I cannot get the true and false records to show. 1 = both, 2=True, 3=False.

IIf([Forms]![frmForecastMaint]![optItemFlag]=1,([tblMPSItemMaster].[FLAG_NON_EMS_ITEM])=True Or ([tblMPSItemMaster].[FLAG_NON_EMS_ITEM])=False,IIf([Forms]![frmForecastMaint]![optItemFlag]=2,False,True))

Am I missing something. If I take out the Iif structure and leave True or False it worksAny ideas?
vmon
 
Have you considered using a Case Statement on the AfterUpdate Event of the optionbox and an Unbound Textbox on the form

Select Case optItemFlag

Case Is = 3
me.textbox = False
Case is = 2
me.textbox = True
Case Is = 3
me.textbox = ""

End Select

Change the criteria of the Query to point at [Forms]![frmName]![Textbox]

Remeber to set the Format of the TextBox to True/False

HTH
 
I figured it out. Because the field was a Yes/No it did not like the True or False. I changed the statement to the one below and it worked fine. All I needed to do was put the field name in place of True or False

Thanks for you suggestion!

IIf([Forms]![frmForecastMaint]![optItemFlag]=1,[tblMPSItemMaster].[FLAG_NON_EMS_ITEM],IIf([Forms]![frmForecastMaint]![optItemFlag]=2,False,True))
 

Users who are viewing this thread

Back
Top Bottom