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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

An IIf Statement as criteria for query: select all? 1

Status
Not open for further replies.

Abi1

Technical User
Jul 4, 2001
19
GB
I'm trying to write a query that selects according to details on a form. For one field, I want to be able to select the field value (from a combo) or select all. I'm put a check box for selecting all.

How do I write a query whose criteria are: If the checkbox is ticked, select everything in this field, otherwise select the value from the combo box.

Thanks,

Abi
 
You could use something like this in a query.

SELECT tbl.* FROM tbl
WHERE tbl.col1 Like "*" & IIf([forms]![frmSelect].[optAll],"",[forms]![frmSelect].[CboSelect]) & "*"));
Terry

"The greatest obstacle to discovery is not ignorance -- it is the illusion of knowledge." - Daniel J Boorstin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top