iif IN QUERY CRITERIA

Soulac

New Member
Joined
Mar 19, 2004
Messages
12
I have would i initially thought was a simple issue I am querying a table with a field called Appt Slot and all it contains is AM or PM .in my query criteria i initially thought to put [enter slot 'AM' Or 'PM' or leave blank for All]
AM AND PM Work fine but just clicking ok on the parameter box Returns Nothing at all so I tried IIf(IsNull([slot])=True,"AM" Or "PM",[slot]) this it seems is too complicated for access to solve. Yet IIf(IsNull([slot])=True,"AM",[slot]) Works Fine. I have Also Tried IIf(IsNull([slot])=True,Like "*M",[slot]) and a lot of other version and differing syntax but to No Avail

Can Anyone Help
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
Try this:
in the Appt Slot field type this in the criteria section of the query:
[enter slot 'AM' Or 'PM' or leave blank for All]

in the OR section (below the criteria section) type this:

[enter slot 'AM' Or 'PM' or leave blank for All] is null

This will return all fields if null or return AM or PM values when specified.
Regards,
 
Upvote 0

Forum statistics

Threads
1,221,691
Messages
6,161,325
Members
451,697
Latest member
pedroDH

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top