Wildcard form search

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi there,

When I use the following code:
stLinkCriteria = "[strVendor]=" & "'" & Me![txtExpVend] & "'"
as part of my open form criteria obviously I get EXACTLY what is typed into
txtExpVend. I want to be able to find "Bay" for example, but if the data was
entered as "The Bay", this code won't find it. I've tried messing aboud with
the * sign but am not sure where to put it.

All help appreciated!

JR
 
Error in my just-sent post. This is the correct expression:

stLinkCriteria = "[strVendor] Like " & "'*" & Me![txtExpVend] & "*'"
 
stLinkCriteria = "[strVendor]=" & "'*" & Me![txtExpVend] & "*'"

The aim is that the result of the expression ends up looking like so ...

'*Bay*'
 
Johnny said:
When I use the following code:
stLinkCriteria = "[strVendor]=" & "'" & Me![txtExpVend] & "'"
as part of my open form criteria obviously I get EXACTLY what is typed into
txtExpVend. I want to be able to find "Bay" for example, but if the data was
entered as "The Bay", this code won't find it. I've tried messing aboud with
the * sign but am not sure where to put it.


stLinkCriteria = "strVendor='*" & Me![txtExpVend] & "*'"
 
Oops! Forgot to change the second "=" to "LIKE" ...

stLinkCriteria = "[strVendor] LIKE " & "'*" & Me![txtExpVend] & "*'"

--
Brendan Reynolds
Access MVP

Brendan Reynolds said:
stLinkCriteria = "[strVendor]=" & "'*" & Me![txtExpVend] & "*'"

The aim is that the result of the expression ends up looking like so ...

'*Bay*'

--
Brendan Reynolds
Access MVP

Johnny Bright said:
Hi there,

When I use the following code:
stLinkCriteria = "[strVendor]=" & "'" & Me![txtExpVend] & "'"
as part of my open form criteria obviously I get EXACTLY what is typed
into
txtExpVend. I want to be able to find "Bay" for example, but if the data
was
entered as "The Bay", this code won't find it. I've tried messing aboud
with
the * sign but am not sure where to put it.

All help appreciated!

JR
 
Hi Marsh
Apperantly almost everybody forgot to change the = to Like

--
\\// Live Long and Prosper \\//


Marshall Barton said:
Johnny said:
When I use the following code:
stLinkCriteria = "[strVendor]=" & "'" & Me![txtExpVend] & "'"
as part of my open form criteria obviously I get EXACTLY what is typed into
txtExpVend. I want to be able to find "Bay" for example, but if the data was
entered as "The Bay", this code won't find it. I've tried messing aboud with
the * sign but am not sure where to put it.


stLinkCriteria = "strVendor='*" & Me![txtExpVend] & "*'"
 
Thanks all for that group effort! Works perfectly!

JR
--
www.brightfuture.ca/bright
My email address can be found on my site.


Ofer said:
Hi Marsh
Apperantly almost everybody forgot to change the = to Like

--
\\// Live Long and Prosper \\//


Marshall Barton said:
Johnny said:
When I use the following code:
stLinkCriteria = "[strVendor]=" & "'" & Me![txtExpVend] & "'"
as part of my open form criteria obviously I get EXACTLY what is typed into
txtExpVend. I want to be able to find "Bay" for example, but if the data was
entered as "The Bay", this code won't find it. I've tried messing aboud with
the * sign but am not sure where to put it.


stLinkCriteria = "strVendor='*" & Me![txtExpVend] & "*'"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top