Snowflake68
Registered User.
- Local time
- Today, 23:34
- Joined
- May 28, 2014
- Messages
- 464
I would really appreciate some help with the correct syntax for a query to show all records if checkbox is ticked on form. Basically if the checkbox is unticked (false) then show only records that are false but if the checkbox is ticked (true) then to show ALL records regardless on the value of the field.
The field type is a Yes/No field and I have tried the following but it will only return either true or false records depending on whether the checkbox is ticked or not. I want to show all records when the checkbox is true.
I can confirm that when I just enter the criteria for <=0 it returns all records so why doesnt it work in the above if statement?
This is the SQL for the MS Access query.
The field type is a Yes/No field and I have tried the following but it will only return either true or false records depending on whether the checkbox is ticked or not. I want to show all records when the checkbox is true.
Code:
IIf([Forms]![frmSearchItemSelection]![chkMSPM]=True,<=0,0)
I can confirm that when I just enter the criteria for <=0 it returns all records so why doesnt it work in the above if statement?
This is the SQL for the MS Access query.
Code:
SELECT [0_Cntrl_ItemSelection].MStreamPMerch, [0_Cntrl_ItemSelection].Item_No_
FROM 0_Cntrl_ItemSelection
WHERE ((([0_Cntrl_ItemSelection].MStreamPMerch)=IIf([Forms]![frmSearchItemSelection]![chkMSPM]=True,([0_Cntrl_ItemSelection].MStreamPMerch)<=0,0)));