use of single quote and dash characters is disenabling open form f

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have title of articles in a main form and added a command button that opens
to another form with more information about that specific article. If the
title has single quotes within it, the command button to open the other form
does not work and I get the error message: "Syntax error (missing operator)
in query expression '[titleofarticle]='test article title one-this is a
test's." The dash does not seem to be a problem but the single quote is. Is
there anything I can do about this? What exactly is this error message
telling me? Thank you.
 
"[titleofarticle] = " & """test article title one-this is a test's."""

The dash is not a problem. That's 3 double quotes at each end of the string.

UpRider
 
Uprider, I don't understand what you mean. Please elaborate. The title of the
article is text in a field that has been designated as a text field.

UpRider said:
"[titleofarticle] = " & """test article title one-this is a test's."""

The dash is not a problem. That's 3 double quotes at each end of the string.

UpRider

Debbie S. said:
I have title of articles in a main form and added a command button that
opens
to another form with more information about that specific article. If the
title has single quotes within it, the command button to open the other
form
does not work and I get the error message: "Syntax error (missing
operator)
in query expression '[titleofarticle]='test article title one-this is a
test's." The dash does not seem to be a problem but the single quote is.
Is
there anything I can do about this? What exactly is this error message
telling me? Thank you.
 
The problem is caused by your choice of text delimiter. Access allows either
single quote or double quote as a text delimiter. However, if you choose to
use a single quote as a delimiter, and the text you're delimiting includes a
single quote (or apostrophe), you run into problems.

See whether my May, 2004 "Access Answers" column in Pinnacle Publication's
"Smart Access" helps. You can download the column (and sample database) for
free at http://www.accessmvp.com/djsteele/smartaccess.html

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Debbie S. said:
Uprider, I don't understand what you mean. Please elaborate. The title of
the
article is text in a field that has been designated as a text field.

UpRider said:
"[titleofarticle] = " & """test article title one-this is a test's."""

The dash is not a problem. That's 3 double quotes at each end of the
string.

UpRider

Debbie S. said:
I have title of articles in a main form and added a command button that
opens
to another form with more information about that specific article. If
the
title has single quotes within it, the command button to open the other
form
does not work and I get the error message: "Syntax error (missing
operator)
in query expression '[titleofarticle]='test article title one-this is a
test's." The dash does not seem to be a problem but the single quote
is.
Is
there anything I can do about this? What exactly is this error message
telling me? Thank you.
 
I'm simply saying that the query expression that you posted as:
'[titleofarticle]='test article title one-this is a test's."
you should change to "[titleofarticle] = " & """test article title one-this
is a test's."""

UpRider

Debbie S. said:
Uprider, I don't understand what you mean. Please elaborate. The title of
the
article is text in a field that has been designated as a text field.

UpRider said:
"[titleofarticle] = " & """test article title one-this is a test's."""

The dash is not a problem. That's 3 double quotes at each end of the
string.

UpRider

Debbie S. said:
I have title of articles in a main form and added a command button that
opens
to another form with more information about that specific article. If
the
title has single quotes within it, the command button to open the other
form
does not work and I get the error message: "Syntax error (missing
operator)
in query expression '[titleofarticle]='test article title one-this is a
test's." The dash does not seem to be a problem but the single quote
is.
Is
there anything I can do about this? What exactly is this error message
telling me? Thank you.
 

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

Back
Top