Whole word Match

  • Thread starter Visio Candar Control
  • Start date
V

Visio Candar Control

I am using findfirst to locate records within my recordset. I would like the
record to be found only if the whole word exactly matches any word within the
sentence being searched. i.e.

String “Johnson Foodstore†returns false when searching for “John†but
String “John Smith Foodstore†returns true.

I have tried using wildcards but get to many unmatched returns.
Any help appreciated.
Joe
 
V

Visio Candar Control

Hello Alex

I have tried:


(both strsearch 1 & 2 declared as strings. The string being searched =
“Johns Foodstore†the search string = “Johnsâ€

strsearch1 = "* " & astrTemp(intRow)
strsearch2 = "* " & astrTemp(intRow) & " *"

with:

rstSearch.FindFirst "[ProjectName] = '" & strsearch1& & "' or [ProjectName]
= '" & strsearch2 & "'"

Although I know the string exists the search fails.

Do you have any suggestions?

Regards
Joe
 
A

Alex Dybenko

hi,
should be:

rstSearch.FindFirst "[ProjectName] Like '" & strsearch1& & "' or
[ProjectName] Like '" & strsearch2 & "'"

--
Alex Dybenko (MVP)
http://Alex.Dybenko.com
http://www.PointLtd.com


Visio Candar Control said:
Hello Alex

I have tried:


(both strsearch 1 & 2 declared as strings. The string being searched =
"Johns Foodstore" the search string = "Johns"

strsearch1 = "* " & astrTemp(intRow)
strsearch2 = "* " & astrTemp(intRow) & " *"

with:

rstSearch.FindFirst "[ProjectName] = '" & strsearch1& & "' or
[ProjectName]
= '" & strsearch2 & "'"

Although I know the string exists the search fails.

Do you have any suggestions?

Regards
Joe




Alex Dybenko said:
Hi,
you can try to search for %John %
with space at the end

--
Alex Dybenko (MVP)
http://Alex.Dybenko.com
http://www.PointLtd.com


"Visio Candar Control" <[email protected]>
wrote
in message news:D[email protected]...
 
V

Visio Candar Control

Hi Alex
There appears to be a quote missing in your search string VBA complains off
an “expected end of statement when the line is pasted and highlights the
second [ProjectName]


Regards
Joe

Alex Dybenko said:
hi,
should be:

rstSearch.FindFirst "[ProjectName] Like '" & strsearch1& & "' or
[ProjectName] Like '" & strsearch2 & "'"

--
Alex Dybenko (MVP)
http://Alex.Dybenko.com
http://www.PointLtd.com


Visio Candar Control said:
Hello Alex

I have tried:


(both strsearch 1 & 2 declared as strings. The string being searched =
"Johns Foodstore" the search string = "Johns"

strsearch1 = "* " & astrTemp(intRow)
strsearch2 = "* " & astrTemp(intRow) & " *"

with:

rstSearch.FindFirst "[ProjectName] = '" & strsearch1& & "' or
[ProjectName]
= '" & strsearch2 & "'"

Although I know the string exists the search fails.

Do you have any suggestions?

Regards
Joe




Alex Dybenko said:
Hi,
you can try to search for %John %
with space at the end

--
Alex Dybenko (MVP)
http://Alex.Dybenko.com
http://www.PointLtd.com


"Visio Candar Control" <[email protected]>
wrote
in message I am using findfirst to locate records within my recordset. I would like
the
record to be found only if the whole word exactly matches any word
within
the
sentence being searched. i.e.

String "Johnson Foodstore" returns false when searching for "John" but
String "John Smith Foodstore" returns true.

I have tried using wildcards but get to many unmatched returns.
Any help appreciated.
Joe
 
A

Alex Dybenko

yes, you right!

Visio Candar Control said:
Hi Alex
There appears to be a quote missing in your search string VBA complains
off
an "expected end of statement when the line is pasted and highlights the
second [ProjectName]


Regards
Joe

Alex Dybenko said:
hi,
should be:

rstSearch.FindFirst "[ProjectName] Like '" & strsearch1& & "' or
[ProjectName] Like '" & strsearch2 & "'"

--
Alex Dybenko (MVP)
http://Alex.Dybenko.com
http://www.PointLtd.com


"Visio Candar Control" <[email protected]>
wrote
in message news:[email protected]...
Hello Alex

I have tried:


(both strsearch 1 & 2 declared as strings. The string being searched =
"Johns Foodstore" the search string = "Johns"

strsearch1 = "* " & astrTemp(intRow)
strsearch2 = "* " & astrTemp(intRow) & " *"

with:

rstSearch.FindFirst "[ProjectName] = '" & strsearch1& & "' or
[ProjectName]
= '" & strsearch2 & "'"

Although I know the string exists the search fails.

Do you have any suggestions?

Regards
Joe




:

Hi,
you can try to search for %John %
with space at the end

--
Alex Dybenko (MVP)
http://Alex.Dybenko.com
http://www.PointLtd.com


"Visio Candar Control" <[email protected]>
wrote
in message I am using findfirst to locate records within my recordset. I would
like
the
record to be found only if the whole word exactly matches any word
within
the
sentence being searched. i.e.

String "Johnson Foodstore" returns false when searching for "John"
but
String "John Smith Foodstore" returns true.

I have tried using wildcards but get to many unmatched returns.
Any help appreciated.
Joe
 
V

Visio Candar Control

Hi Alex

I maybe right but I cannot workout where the quote should go. Could you
re-post the correct search string.

Regards
Joe

Alex Dybenko said:
yes, you right!

Visio Candar Control said:
Hi Alex
There appears to be a quote missing in your search string VBA complains
off
an "expected end of statement when the line is pasted and highlights the
second [ProjectName]


Regards
Joe

Alex Dybenko said:
hi,
should be:

rstSearch.FindFirst "[ProjectName] Like '" & strsearch1& & "' or
[ProjectName] Like '" & strsearch2 & "'"

--
Alex Dybenko (MVP)
http://Alex.Dybenko.com
http://www.PointLtd.com


"Visio Candar Control" <[email protected]>
wrote
in message Hello Alex

I have tried:


(both strsearch 1 & 2 declared as strings. The string being searched =
"Johns Foodstore" the search string = "Johns"

strsearch1 = "* " & astrTemp(intRow)
strsearch2 = "* " & astrTemp(intRow) & " *"

with:

rstSearch.FindFirst "[ProjectName] = '" & strsearch1& & "' or
[ProjectName]
= '" & strsearch2 & "'"

Although I know the string exists the search fails.

Do you have any suggestions?

Regards
Joe




:

Hi,
you can try to search for %John %
with space at the end

--
Alex Dybenko (MVP)
http://Alex.Dybenko.com
http://www.PointLtd.com


"Visio Candar Control" <[email protected]>
wrote
in message I am using findfirst to locate records within my recordset. I would
like
the
record to be found only if the whole word exactly matches any word
within
the
sentence being searched. i.e.

String "Johnson Foodstore" returns false when searching for "John"
but
String "John Smith Foodstore" returns true.

I have tried using wildcards but get to many unmatched returns.
Any help appreciated.
Joe
 
A

Alex Dybenko

ok, there were 2 extra ampersands
rstSearch.FindFirst "[ProjectName] Like '" & strsearch1 & "' or
[ProjectName] Like '" & strsearch2 & "'"

--
Alex Dybenko (MVP)
http://Alex.Dybenko.com
http://www.PointLtd.com


Visio Candar Control said:
Hi Alex

I maybe right but I cannot workout where the quote should go. Could you
re-post the correct search string.

Regards
Joe

Alex Dybenko said:
yes, you right!

"Visio Candar Control" <[email protected]>
wrote
in message news:[email protected]...
Hi Alex
There appears to be a quote missing in your search string VBA complains
off
an "expected end of statement when the line is pasted and highlights
the
second [ProjectName]


Regards
Joe

:

hi,
should be:

rstSearch.FindFirst "[ProjectName] Like '" & strsearch1& & "' or
[ProjectName] Like '" & strsearch2 & "'"

--
Alex Dybenko (MVP)
http://Alex.Dybenko.com
http://www.PointLtd.com


"Visio Candar Control" <[email protected]>
wrote
in message Hello Alex

I have tried:


(both strsearch 1 & 2 declared as strings. The string being searched
=
"Johns Foodstore" the search string = "Johns"

strsearch1 = "* " & astrTemp(intRow)
strsearch2 = "* " & astrTemp(intRow) & " *"

with:

rstSearch.FindFirst "[ProjectName] = '" & strsearch1& & "' or
[ProjectName]
= '" & strsearch2 & "'"

Although I know the string exists the search fails.

Do you have any suggestions?

Regards
Joe




:

Hi,
you can try to search for %John %
with space at the end

--
Alex Dybenko (MVP)
http://Alex.Dybenko.com
http://www.PointLtd.com


"Visio Candar Control"
<[email protected]>
wrote
in message
I am using findfirst to locate records within my recordset. I
would
like
the
record to be found only if the whole word exactly matches any
word
within
the
sentence being searched. i.e.

String "Johnson Foodstore" returns false when searching for
"John"
but
String "John Smith Foodstore" returns true.

I have tried using wildcards but get to many unmatched returns.
Any help appreciated.
Joe
 
J

JoeBo

Hello Alex

благодарю Ð²Ð°Ñ Ð·Ð° помощь

JoeBo


Alex Dybenko said:
ok, there were 2 extra ampersands
rstSearch.FindFirst "[ProjectName] Like '" & strsearch1 & "' or
[ProjectName] Like '" & strsearch2 & "'"

--
Alex Dybenko (MVP)
http://Alex.Dybenko.com
http://www.PointLtd.com


Visio Candar Control said:
Hi Alex

I maybe right but I cannot workout where the quote should go. Could you
re-post the correct search string.

Regards
Joe

Alex Dybenko said:
yes, you right!

"Visio Candar Control" <[email protected]>
wrote
in message Hi Alex
There appears to be a quote missing in your search string VBA complains
off
an "expected end of statement when the line is pasted and highlights
the
second [ProjectName]


Regards
Joe

:

hi,
should be:

rstSearch.FindFirst "[ProjectName] Like '" & strsearch1& & "' or
[ProjectName] Like '" & strsearch2 & "'"

--
Alex Dybenko (MVP)
http://Alex.Dybenko.com
http://www.PointLtd.com


"Visio Candar Control" <[email protected]>
wrote
in message Hello Alex

I have tried:


(both strsearch 1 & 2 declared as strings. The string being searched
=
"Johns Foodstore" the search string = "Johns"

strsearch1 = "* " & astrTemp(intRow)
strsearch2 = "* " & astrTemp(intRow) & " *"

with:

rstSearch.FindFirst "[ProjectName] = '" & strsearch1& & "' or
[ProjectName]
= '" & strsearch2 & "'"

Although I know the string exists the search fails.

Do you have any suggestions?

Regards
Joe




:

Hi,
you can try to search for %John %
with space at the end

--
Alex Dybenko (MVP)
http://Alex.Dybenko.com
http://www.PointLtd.com


"Visio Candar Control"
<[email protected]>
wrote
in message
I am using findfirst to locate records within my recordset. I
would
like
the
record to be found only if the whole word exactly matches any
word
within
the
sentence being searched. i.e.

String "Johnson Foodstore" returns false when searching for
"John"
but
String "John Smith Foodstore" returns true.

I have tried using wildcards but get to many unmatched returns.
Any help appreciated.
Joe
 

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

Top