Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problem with comma's in SQL

Status
Not open for further replies.
Sep 25, 2002
159
US
I have this SQL statement that is throwing an error saying there is a comma in the query expression. The problem is that is the way the data is in the database. the 'UserName' variable looks like this:

Smith, Jane
Doe, John

And so does the [Assigned To] variable

MySQL = "SELECT [Issue ID] FROM QPTActions WHERE [Assigned To] = " & UserName & ";"

How can I get around this?

Thank you.
 
Apostrophes!

Code:
MySQL = "SELECT [Issue ID] FROM QPTActions WHERE [Assigned To] = '" & Replace(UserName, "'", "''") & "';"

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top