Link to home
Start Free TrialLog in
Avatar of chestera
chestera

asked on

Like search using chr(34)

Hi EE

I am having problems with a like search using chr(34)
Here is my code
Search = "SELECT * FROM tblCustomer WHERE [SurName] = " & Chr(34) & Me!txtSurname & Chr(34)
I want to change to a like search. I have tried
Search = "SELECT * FROM tblCustomer WHERE [SurName] Like " * [" & Chr(34) & "] * " &  Me!txtSurname & Chr(34)"

Any help appreciated

I need to use chr(34) because we have a lot of O'Brians etc

chestera
Avatar of Joe Howard
Joe Howard
Flag of United States of America image

Try:
Search = "SELECT * FROM tblCustomer WHERE [SurName] Like * " & Chr(39) & " * " &  Me!txtSurname

Open in new window

Avatar of chestera
chestera

ASKER

MacroShadow

I tried
Search = "SELECT * FROM tblCustomer WHERE [SurName] Like * " & Chr(39) & " * " & Me!txtSurname

Get message missing operator, should there be something after me!txtsurname

Alan
SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Macroshadow

Search = "SELECT * FROM tblCustomer WHERE [SurName] Like " & Chr(34) & Me!txtSurname & Chr(39) & "*" & Chr(34)

The above wont find any surname. I have for example I entered Jones which is a current surbname it didn't find it.

Alan
IrogSinta

Enter both
Search = "SELECT * FROM tblCustomer WHERE [SurName] LIKE " & Chr(34) & Me!txtSurname & Chr(34)
Search = "SELECT * FROM tblCustomer WHERE [SurName] LIKE """  & Me!txtSurname & """"

for example I searched for Jones and it finds all jones but if I enter Jon no luck

Your help is appreciated

Alan
Guy Hengel

Search = "SELECT * FROM tblCustomer WHERE [SurName] Like  " & Chr(39) & "*" & Me!txtSurname & "*" & chr(39)

It will find full name but not a partial name

Alan
Macroshadow

My Apologies. I must have a bug in the form I was using your code, I used another form an it worked.

I am going to ward point to all three in fairness. You was first so you get best solution.

Alan
IrogSinta

My Apologies. I must have a bug in the form I was using your code, I used another form an it worked.

I am going to ward point to all three in fairness
Alan
Guy Hengel

My Apologies. I must have a bug in the form I was using your code, I used another form an it worked.

I am going to ward point to all three in fairness. Alan