[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Like search using chr(34)

Posted on 2016-07-23
11
Medium Priority
?
72 Views
Last Modified: 2016-07-24
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
0
Comment
Question by:chestera
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
11 Comments
 
LVL 27

Expert Comment

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

Open in new window

0
 

Author Comment

by:chestera
ID: 41726184
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
0
 
LVL 143

Assisted Solution

by:Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3] earned 500 total points
ID: 41726191
the * need to be part of the string loke this

Search = "SELECT * FROM tblCustomer WHERE [SurName] Like  " & Chr(34) & "*" & Me!txtSurname & "*" & chr(34)
1
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 27

Accepted Solution

by:
MacroShadow earned 1000 total points
ID: 41726197
Perhaps this:
Search = "SELECT * FROM tblCustomer WHERE [SurName] Like " & Chr(34) & Me!txtSurname & Chr(39) & "*" & Chr(34)
1
 
LVL 29

Assisted Solution

by:IrogSinta
IrogSinta earned 500 total points
ID: 41726229
Both of the following work.  For the latter I just used double quotation marks instead Chr(34).  Take your pick:
Search = "SELECT * FROM tblCustomer WHERE [SurName] LIKE " & Chr(34) & Me!txtSurname & Chr(34)
Search = "SELECT * FROM tblCustomer WHERE [SurName] LIKE """  & Me!txtSurname & """"

Open in new window


Ron
0
 

Author Comment

by:chestera
ID: 41726435
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
0
 

Author Comment

by:chestera
ID: 41726437
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
0
 

Author Comment

by:chestera
ID: 41726440
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
0
 

Author Comment

by:chestera
ID: 41726449
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
0
 

Author Comment

by:chestera
ID: 41726450
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
0
 

Author Comment

by:chestera
ID: 41726453
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
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question