syntax for stlinkcriteria

J

Joel

TIA:
I have the following:

stLinkCriteria = "[Common Name]=" & "'" & [MaterialDescription] & "'"

This works fine unless [MaterialDescription] contains an ' as some of the
data does such as "Mary's". I have read about using double quotes. I have
tried

stLinkCriteria = "[Common Name]=" & """'" & [MaterialDescription] & "'"""
and it doesn't work.

I have tried

stLinkCriteria = "[Common Name]=" & """ & [MaterialDescription] & """""
and it doesn't work.

What am I missing here. What is the correct syntax?

Thanks,

Joel
 
F

fredg

TIA:
I have the following:

stLinkCriteria = "[Common Name]=" & "'" & [MaterialDescription] & "'"

This works fine unless [MaterialDescription] contains an ' as some of the
data does such as "Mary's". I have read about using double quotes. I have
tried

stLinkCriteria = "[Common Name]=" & """'" & [MaterialDescription] & "'"""
and it doesn't work.

I have tried

stLinkCriteria = "[Common Name]=" & """ & [MaterialDescription] & """""
and it doesn't work.

What am I missing here. What is the correct syntax?

Thanks,

Joel

[Common Name] is a Text datatype? If so, try:

stLinkCriteria = "[Common Name]=""" & [MaterialDescription] & """"

For clarity, the quotes are:
"[Common Name]=" " " & [MaterialDescription] & " " " "
 
J

Joel

Fred:

Yes [Common Name] is text data.
Thanks so much..it works

Joel

fredg said:
TIA:
I have the following:

stLinkCriteria = "[Common Name]=" & "'" & [MaterialDescription] & "'"

This works fine unless [MaterialDescription] contains an ' as some of the
data does such as "Mary's". I have read about using double quotes. I have
tried

stLinkCriteria = "[Common Name]=" & """'" & [MaterialDescription] & "'"""
and it doesn't work.

I have tried

stLinkCriteria = "[Common Name]=" & """ & [MaterialDescription] & """""
and it doesn't work.

What am I missing here. What is the correct syntax?

Thanks,

Joel

[Common Name] is a Text datatype? If so, try:

stLinkCriteria = "[Common Name]=""" & [MaterialDescription] & """"

For clarity, the quotes are:
"[Common Name]=" " " & [MaterialDescription] & " " " "
 
D

Douglas J. Steele

Note, though, that it while it will now work if MaterialDescription contains
an apostrophe, it will not work if it contains double quotes (such as "A
piece of lumber 2'8" long") To be able to handle strings like that, see my
May, 2004 "Access Answers" column in Pinnacle Publication's "Smart Access".
You can download the column (and sample database) for free at
http://www.accessmvp.com/djsteele/SmartAccess.html

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Joel said:
Fred:

Yes [Common Name] is text data.
Thanks so much..it works

Joel

fredg said:
TIA:
I have the following:

stLinkCriteria = "[Common Name]=" & "'" & [MaterialDescription] &
"'"

This works fine unless [MaterialDescription] contains an ' as some of
the
data does such as "Mary's". I have read about using double quotes. I
have
tried

stLinkCriteria = "[Common Name]=" & """'" & [MaterialDescription] &
"'"""
and it doesn't work.

I have tried

stLinkCriteria = "[Common Name]=" & """ & [MaterialDescription] & """""
and it doesn't work.

What am I missing here. What is the correct syntax?

Thanks,

Joel

[Common Name] is a Text datatype? If so, try:

stLinkCriteria = "[Common Name]=""" & [MaterialDescription] & """"

For clarity, the quotes are:
"[Common Name]=" " " & [MaterialDescription] & " " " "
 

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

Top