I have set up a form with two text boxes which feed the search words in a query.
The first text box is mandatory. The second text box is optional, it only appears if the user clicks on a check box in the form.
This is how it is supposed to work: The user will enter a single word or string of characters in the first textbox and click a command button which will run the query and generate a report based on the query.
If the user wishes to use a second string with the first string, he/she will click the checkbox, the second textbox appears and he/she can enter the second string and click on the command button which will run the query and generate a report based on the query.
The report will contain different records with the search words.
I tried using the following statement in the query criteria but it doesn't work. Apparently it is "too complex" (according to the error message Access returns).
IIf([Forms]![frmMultiSearch]![chkaddsearch]=0,([tblCust].[lookhere]) Like "*" & [Forms]![frmMultiSearch]![searchBox1],([tblCust].[lookhere]) Like "*" & [Forms]![frmMultiSearch]![searchBox1] & "*" Or ([tblCust].[lookhere]) Like "*" & [Forms]![frmMultiSearch]![searchBox2] & "*")
Is there another way I can do this?
Please help!
Thank you for your help.
The first text box is mandatory. The second text box is optional, it only appears if the user clicks on a check box in the form.
This is how it is supposed to work: The user will enter a single word or string of characters in the first textbox and click a command button which will run the query and generate a report based on the query.
If the user wishes to use a second string with the first string, he/she will click the checkbox, the second textbox appears and he/she can enter the second string and click on the command button which will run the query and generate a report based on the query.
The report will contain different records with the search words.
I tried using the following statement in the query criteria but it doesn't work. Apparently it is "too complex" (according to the error message Access returns).
IIf([Forms]![frmMultiSearch]![chkaddsearch]=0,([tblCust].[lookhere]) Like "*" & [Forms]![frmMultiSearch]![searchBox1],([tblCust].[lookhere]) Like "*" & [Forms]![frmMultiSearch]![searchBox1] & "*" Or ([tblCust].[lookhere]) Like "*" & [Forms]![frmMultiSearch]![searchBox2] & "*")
Is there another way I can do this?
Please help!
Thank you for your help.