syntax for stlinkcriteria

  • Thread starter Thread starter Joel
  • Start date Start date
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
 
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] & " " " "
 
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] & " " " "
 
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] & " " " "
 
Back
Top