![]() |
|
|
#1
|
|||
|
|||
|
I have a SQL written like this:
TheName = Bash'n'Crash "SELECT * FROM Clients WHERE ClientName = '" + TheName + "'" There are two apostrophies in the query and Access does not find the records. If I only have one apostrophy in the word like in the following then it will work: TheName = O'Brien Changed TheName to read as O''Brien with two apostrophies between the O and Brien. "SELECT * FROM Clients WHERE ClientName = '" + TheName + "'" I have tried putting two apostrophies in the Bash''n''Crash name but it does not work. Any help please? |
|
#2
|
||||
|
||||
|
Leave TheName alone and change your delimiter to a double quote:
"SELECT * FROM Clients WHERE ClientName = """ & TheName & """" That is 3 at the beginning and 4 at the end. You shoud also use the "&" as the string concantenation character rather than the "+".
__________________
(RG for short) aka Allan Bunch MS Access MVP - WinXP Pro, Win7 - acXP, ac07 If your issue is resolved...follow this link for directions on how to use the Solved thread tool! Teaching is not filling a bucket but lighting a fire. Borrowed quote..."Docendo discimus" |
|
#3
|
|||
|
|||
|
Thanks Rural Guy.
I cannot use the & instead of the + in the software language I am using. The + is an operator that appends two strings together. It looks like you are saying surround TheName with double Quotes in the select Statement rather than with apostrophy. EDIT Ok - I tried that but it did not work. NO records were found in the SELECT statement. Here is the SELECT etc. Quote:
BPak |
|
#4
|
||||
|
||||
|
When you used the code you posted was the horses name Bash'n'Crash with just single ticks around the 'n' and no records were returned; or had you modified the name at that point?
__________________
(RG for short) aka Allan Bunch MS Access MVP - WinXP Pro, Win7 - acXP, ac07 If your issue is resolved...follow this link for directions on how to use the Solved thread tool! Teaching is not filling a bucket but lighting a fire. Borrowed quote..."Docendo discimus" |
|
#5
|
|||
|
|||
|
Quote:
Matter of fact NO records were returned for any of the horses when I used that code. Double quotes were not accepted in the query. |
|
#6
|
||||
|
||||
|
Thanks for posting back. At least you have found a solution for your issue. BTW, what software are you using if not Access?
__________________
(RG for short) aka Allan Bunch MS Access MVP - WinXP Pro, Win7 - acXP, ac07 If your issue is resolved...follow this link for directions on how to use the Solved thread tool! Teaching is not filling a bucket but lighting a fire. Borrowed quote..."Docendo discimus" |
|
#7
|
|||
|
|||
|
I am using Emergence BASIC.
|
|
#8
|
||||
|
||||
|
Thanks for responding.
__________________
(RG for short) aka Allan Bunch MS Access MVP - WinXP Pro, Win7 - acXP, ac07 If your issue is resolved...follow this link for directions on how to use the Solved thread tool! Teaching is not filling a bucket but lighting a fire. Borrowed quote..."Docendo discimus" |
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| VBA Script to run select query | pushpm | Programming | 2 | 05-06-2009 06:36 AM |
| Select query with two criteria | corni | Queries | 1 | 01-22-2009 02:23 AM |
| very difficult (for me!) SELECT query | igorbaldacci | Queries | 1 | 12-02-2008 12:30 PM |
| Combo box select from two fields | cnestg8r | Access | 0 | 10-31-2008 08:05 AM |
| SELECT FUNCTION help please | scott munkirs | Queries | 0 | 10-17-2006 05:44 AM |