Forum Discussion
Tony2021
Sep 18, 2022Steel Contributor
Query with User Input Box
hello Experts, I have a query with 2 different conditions. 1. I can type in part of a company name in a input message box or 2. I can type in a draw number (tblPmtProposalALL.DDNo) in the next m...
- Sep 18, 2022
Tony2021 Try below SQL with IIF() function in where clause. See the attached DB.
SELECT Table1.ProjID, Table1.DateStart, Table1.DateEnd, Table1.Description, Table1.Rate FROM Table1 WHERE (((Table1.Description) Like IIf(IsNull([Enter Criteria 1]),"*","*" & [Enter Criteria 1] & "*")) AND ((Table1.Rate)=[Enter DD No or enter for all]));
Here when you will leave first inputbox blank then it will return just * by IIF() function. which will return all records of description field. Otherwise will return *Your Input Text*.
Harun24HR
Sep 18, 2022Bronze Contributor
Share a sample db file file.