Like and = (1 Viewer)

kirkm

Registered User.
Local time
Today, 11:59
Joined
Oct 30, 2008
Messages
1,257
Is there a solution for this kind of scenario?
I'm searching through a list of Performers, lets say "Queen" and "The Rolling Stones"
If I search for *Rolling Stones* I'll get instances of "The Rolling Stones". Good.
But if I search for *Queen*" I'll get "Queen Vs The Miami Project" amongst others. Bad.

So perhaps a buttone to select "Absolute" or "Like"? but - is there a better way ?
Thanks.
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 16:59
Joined
Oct 29, 2018
Messages
21,473
But how do you decide which results are bad? Computers work with logic. If you can specify the logic, the computer will simply do what you tell it to.
 

Isaac

Lifelong Learner
Local time
Yesterday, 16:59
Joined
Mar 14, 2017
Messages
8,777
Is there a solution for this kind of scenario?
I'm searching through a list of Performers, lets say "Queen" and "The Rolling Stones"
If I search for *Rolling Stones* I'll get instances of "The Rolling Stones". Good.
But if I search for *Queen*" I'll get "Queen Vs The Miami Project" amongst others. Bad.

So perhaps a buttone to select "Absolute" or "Like"? but - is there a better way ?
Thanks.
Are you referring to a GUI you've built to let your customers search things?

If so, then yes - you may want to give them a choice of operand, in friendly terms.

Was that your question?

It could be that what you're after is the difference between
like '*Queen*'
vs
like '*Queen'

but I can't tell.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Yesterday, 18:59
Joined
Feb 28, 2001
Messages
27,184
Computers do two kinds of matches for most searches. Exact matches - where an "=" sign is used and the computer looks for exactly what you used as the comparand, or "Like" matches - where you have some sort of regular expression that can include wildcard characters, and the computer returns whatever matches the pattern. If the pattern allows for variation, you get variation.

In the specific case you named, there is the possibility of searching for "*Queen" - meaning anything that ends with "Queen" - but it allows prefixes.
 

kirkm

Registered User.
Local time
Today, 11:59
Joined
Oct 30, 2008
Messages
1,257
The search is for "Queen" from a list that might contain

Queen Vs The Miami Project
Queen
Queens Of The Stone Age
The Good The Bad & The Queen

In that case =Queen would do it. Both *Queen or Queen* would fail.
My question was how is that handled by the Pros? That is, to select just the required one?
I suspect it can't be done, but I'm asking 'cause there's a lot I don't know !
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 16:59
Joined
Oct 29, 2018
Messages
21,473
The search is for "Queen" from a list that might contain

Queen Vs The Miami Project
Queen
Queens Of The Stone Age
The Good The Bad & The Queen

In that case =Queen would do it. Both *Queen or Queen* would fail.
My question was how is that handled by the Pros? That is, to select just the required one?
I suspect it can't be done, but I'm asking 'cause there's a lot I don't know !
Sorry, you lost me. Perhaps, I'm just too sleepy.

Maybe I'll understand what you mean after a good night's rest, or maybe I'll wake up tomorrow and find you already got it figured out.

Have a good night. See you in the morning.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Yesterday, 18:59
Joined
Feb 28, 2001
Messages
27,184
OK, from your list of four choices, and you claim there is only one choice, you would search for Trim$(Fieldname) = "Queen" to get the second record and no other. If there is even the slightest chance that you could have spaces, you need to "prepare" the search field. On the other hand, if you know that there were no leading or trailing spaces in the field, you wouldn't need the TRIM function.
 

CJ_London

Super Moderator
Staff member
Local time
Today, 00:59
Joined
Feb 19, 2013
Messages
16,612
I'm searching through a list of Performers, lets say "Queen" and "The Rolling Stones"
sounds to me like either your table structure is incorrect or you need to clarify your criteria

Queen and the rolling stones are performers, Queen Vs The Miami Project is an album and should not be classified as a performer
 

Isaac

Lifelong Learner
Local time
Yesterday, 16:59
Joined
Mar 14, 2017
Messages
8,777
the whole purpose of using the equal sign is if your user already knows that they are searching for that specifically and nothing else.

the whole reason for using a wild card is that they are going to expect it will bring up more things than just that exact text. That's normal behavior. you give them a search results in a little list box and then let them click on the list box to select the exact one..
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 16:59
Joined
Oct 29, 2018
Messages
21,473
Sorry, you lost me. Perhaps, I'm just too sleepy.

Maybe I'll understand what you mean after a good night's rest, or maybe I'll wake up tomorrow and find you already got it figured out.

Have a good night. See you in the morning.
Okay, after a good night's rest, I had a thought. Maybe something like this is what you want (where the user has flexibility to search specific requirements).

1606404540935.png


Remember when I asked you "how do you decide" what results you want? This feature, or something similar to it, tells Access exactly what your decision was.

Hope that helps...
 

Users who are viewing this thread

Top Bottom