Query question regarding mutiple criteria

S

Sung

I have a form with a frame with 5 choices. 1,2,3,4,5

I want a query to retrive data based on what they pick.

Can someone please let me know how to fix this.

IIf(([Forms]![frmAssignedtoo2]![Frame0]=2) Or
([Forms]![frmAssignedtoo2]![Frame0]=4),In
("set1","set3","set4"),IIf(([Forms]![frmAssignedtoo2]![Frame0]=3) Or
([Forms]![frmAssignedtoo2]![Frame0]=5),"set2",<>0))

I want the query to pull all the records that have "set1", "set3", or "set4"
if they pick options 2 or 4 from the form. If they pick 3 or 5 from the
form, I want the query to pull all the records with "Set2" and if they pick
option 1, then i want it to pull all the records.

Please help.

Thanks
 
J

John Spencer

IF the field always has a value and is never null, you should be able to use

LIKE "SET" & IIf([Forms]![frmAssignedtoo2]![Frame0]=2 Or
[Forms]![frmAssignedtoo2]![Frame0]=4,"[134]",
IIf([Forms]![frmAssignedtoo2]![Frame0]=3 Or
[Forms]![frmAssignedtoo2]![Frame0]=5,"2","*"))

If the field also could be null then put the following as the criteria

LIKE "SET" & IIf([Forms]![frmAssignedtoo2]![Frame0]=2 Or
[Forms]![frmAssignedtoo2]![Frame0]=4,"[134]",
IIf([Forms]![frmAssignedtoo2]![Frame0]=3 Or
[Forms]![frmAssignedtoo2]![Frame0]=5,"2","*")) OR
[Forms]![frmAssignedtoo2]![Frame0]=1
--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top