Search Function typo?

Huey462

Board Regular
Joined
Jul 25, 2011
Messages
147
Let me preface this with an apology, I’ve been at work way too long and my brain function hovering between a rock and a zombie. If I omitted something or you need further clarification please do not hesitate to ask.
My search function is not working, and I don’t know why, I’m guessing a errant comma or something. Any help would be greatly appreciated. I have one entry from someone with the last name of “Smith”.
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>
Table information is called “SupplyLog”
<o:p></o:p>
Search Form with textboxes to type in search criteria is called “SearchForm”
The name/requestor field is called “Qreq1”
<o:p></o:p>
When the search button is clicked, the form Printable2005 is opened. The data for this form is a query called “FloorReport”
<o:p></o:p>
The criteria for the Requestor field is
Code:
Like "*" & [forms]![SearchForm].[QReq1] & "*"
<o:p></o:p>
I have tried running this both with and without loading/opening the query and the results are the same. Like I said before, I’m guessing my problem lies with the like function, but I’m at a loss.
 
Last edited:

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Please post all of the code behind the form.

Please show us the code associated with
When the search button is clicked,

Where is the code/logic by which
form Printable2005 is opened?
 
Upvote 0
I went through all of the like functions and found the one that was causing the problem, I don't know why this would be the culprit...everything looks good.

Code:
Like "*" & [forms]![SearchForm].[QReq1] & "*"
Like "*" & [forms]![SearchForm].[QJCN1] & "*"
Like "*" & [forms]![SearchForm].[QDoc1] & "*" (PROBLEM)
Like "*" & [forms]![SearchForm].[QStatus1] & "*"
Like "*" & [forms]![SearchForm].[QNoun1] & "*"
Like "*" & [forms]![SearchForm].[QNSN1] & "*"
Like "*" & [forms]![SearchForm].[QPN1] & "*"

My best guess is that if there is nothing in the field searched by the QDOC1, it comes up with nothing, so there needs to have some sort of value in there rather than a NULL/Empty
 
Upvote 0
Can you post the query code?
How do these Like statements fit together

eg, Like A AND Like B?

If any of these fields could be NULL (no VALUE) you may have to check for that

eg

If (Is NULL(forms]![SearchForm].[QReq1] )) then

'display message
msgbox "You must supply a value for qReq1",vbYesNo,"Warning"
else
' OK carry on
endif
 
Upvote 0
I found the problem, in the search form the Document # field was linked to the table rather than having nothing linked to it. Thank you for the responses though :)
 
Upvote 0

Forum statistics

Threads
1,224,590
Messages
6,179,752
Members
452,940
Latest member
rootytrip

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