Search For Record Macro Not Working (1 Viewer)

dmace1

Registered User.
Local time
Today, 15:17
Joined
May 3, 2019
Messages
15
Hi, I have a form in which I've put a search button to bring up a specific record. I want the user to only have to enter one word from a string of words (not necessarily the first word in the string).

This is what I have in the macro:

Object Type: Form
Object Name: InputCaseData
Record: First
Where Condition = :
"CaseTitle = ' "*" & [Forms]![InputCaseData]![SearchForBox] & "*" "

InputCaseData is the form name. SearchForBox is the text box to enter part the search term. CaseTitle is the field I'm searching for.

It's not working at all.

Can anyone help with this problem?

Thank you.
 

Gasman

Enthusiastic Amateur
Local time
Today, 22:17
Joined
Sep 21, 2011
Messages
14,048
You might try the Like keyword instead of =
 

dmace1

Registered User.
Local time
Today, 15:17
Joined
May 3, 2019
Messages
15
Thanks but that did not work either.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 15:17
Joined
Oct 29, 2018
Messages
21,358
Thanks but that did not work either.
Hi. Can you show us exactly how you tried it? "Did not work" is not enough information to help us help you fix it.
 

dmace1

Registered User.
Local time
Today, 15:17
Joined
May 3, 2019
Messages
15
Sure, this is what I put in the where condition.

"CaseTitle Like ' "*" & [Forms]![InputCaseData]![SearchForBox] & "*" "

When I clicked the run macro button, it did nothing.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 15:17
Joined
Oct 29, 2018
Messages
21,358
Sure, this is what I put in the where condition.

"CaseTitle Like ' "*" & [Forms]![InputCaseData]![SearchForBox] & "*" "

When I clicked the run macro button, it did nothing.
Hi. Thanks. I don't use macros, so this is just a guess, but try:
Code:
"CaseTitle Like '*" & [Forms]![InputCaseData]![SearchForBox] & "*'"
Hope it helps...
 

Gasman

Enthusiastic Amateur
Local time
Today, 22:17
Joined
Sep 21, 2011
Messages
14,048
Hi. Thanks. I don't use macros, so this is just a guess, but try:
Code:
"CaseTitle Like '*" & [Forms]![InputCaseData]![SearchForBox] & "*'"
Hope it helps...

That is what I would try as well
Code:
tt="test"
? "CaseTitle Like '*" & tt & "*'" 
CaseTitle Like '*test*
 

Gasman

Enthusiastic Amateur
Local time
Today, 22:17
Joined
Sep 21, 2011
Messages
14,048
Walk through the macro as well, step by step
 

Users who are viewing this thread

Top Bottom