Quotes inside SQL statememt...

W

wwg

This expression is part of an SQL statement copied from the SQL view of a
working make-table query. I can't get it to compile as a direct SQL query.
The quotes seem to be the problem. Replacing them with single quotes allows
the query to run but it no longer works properly then.

"IIf(IsNull([Salutation]),"", [Salutation] & " " & [FName2] & " " & [Last
Name] & " " & [Title] AS Expr2, "

What to do?

Thanks --Wesley
 
K

Ken Snell

Double up the " characters so that ACCESS will "see" them as a single "
character when it creates the text string:

"IIf(IsNull([Salutation]),"""", [Salutation] & "" "" & [FName2] & "" "" &
[Last
Name] & "" "" & [Title] AS Expr2, "
 
W

wwg

Ken:

Right. It now works fine. Thanks for the prompt response.

--Wesley



Ken Snell said:
Double up the " characters so that ACCESS will "see" them as a single "
character when it creates the text string:

"IIf(IsNull([Salutation]),"""", [Salutation] & "" "" & [FName2] & "" "" &
[Last
Name] & "" "" & [Title] AS Expr2, "


--
Ken Snell
<MS ACCESS MVP>

wwg said:
This expression is part of an SQL statement copied from the SQL view of a
working make-table query. I can't get it to compile as a direct SQL query.
The quotes seem to be the problem. Replacing them with single quotes allows
the query to run but it no longer works properly then.

"IIf(IsNull([Salutation]),"", [Salutation] & " " & [FName2] & " " & [Last
Name] & " " & [Title] AS Expr2, "

What to do?

Thanks --Wesley
 

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