|
 |
access thread: SQL query on Access database -- using LIKE + string
Message #1 by "Rudy Bescherer, Jr." <dj_dr_rudy@y...> on Sat, 10 Mar 2001 16:01:42
|
|
I have been trying to write a form that searches my music database, but I
have encountered one major problem thus far. I cannot seem to use double
quotes to delimit the string for the WHILE ... LIKE ... statement and I
need to allow single quotes in the search string (for example, Jessie's
Girl or It's My Life make the search page crash). As a temporary solution I
have substituted the underscore character for the single quotes but that
sometimes returns too many unrelated entries.
Is there any way to get double quotes to work to delimit SQL strings for
Access databases, or to insert a single quote somehow into a string
delimited by single quotes (I already tried \' and '' without success)?
Rudy Bescherer, Jr.
Message #2 by "John Ruff" <papparuff@c...> on Sat, 10 Mar 2001 12:35:03 -0800
|
|
Rudy,
How about showing us your code. I suspect that you can use the original
query your form is based on and then filter it query with the data you are
looking for; but it would be nice to look at your code.
John Ruff - The Eternal Optimist :)
-----Original Message-----
From: Rudy Bescherer, Jr. [mailto:dj_dr_rudy@y...]
Sent: Saturday, March 10, 2001 4:02 PM
To: Access
Subject: [access] SQL query on Access database -- using LIKE + string
I have been trying to write a form that searches my music database, but I
have encountered one major problem thus far. I cannot seem to use double
quotes to delimit the string for the WHILE ... LIKE ... statement and I
need to allow single quotes in the search string (for example, Jessie's
Girl or It's My Life make the search page crash). As a temporary solution I
have substituted the underscore character for the single quotes but that
sometimes returns too many unrelated entries.
Is there any way to get double quotes to work to delimit SQL strings for
Access databases, or to insert a single quote somehow into a string
delimited by single quotes (I already tried \' and '' without success)?
Rudy Bescherer, Jr.
Message #3 by "Pardee, Roy E" <roy.e.pardee@l...> on Mon, 12 Mar 2001 08:27:46 -0800
|
|
To put a double-quote character in a VB string variable, you type two
double-quote chars in a row (the first one 'escape's the second one). So if
you say
strTitle = """Jessie's Girl"""
strTitle will contain the string "Jessie's Girl"
HTH,
-Roy
-----Original Message-----
From: Rudy Bescherer, Jr. [mailto:dj_dr_rudy@y...]
Sent: Saturday, March 10, 2001 8:01 AM
To: Access
Subject: [access] SQL query on Access database -- using LIKE + string
I have been trying to write a form that searches my music database, but I
have encountered one major problem thus far. I cannot seem to use double
quotes to delimit the string for the WHILE ... LIKE ... statement and I
need to allow single quotes in the search string (for example, Jessie's
Girl or It's My Life make the search page crash). As a temporary solution I
have substituted the underscore character for the single quotes but that
sometimes returns too many unrelated entries.
Is there any way to get double quotes to work to delimit SQL strings for
Access databases, or to insert a single quote somehow into a string
delimited by single quotes (I already tried \' and '' without success)?
Rudy Bescherer, Jr.
|
|
 |