SQL error when using an 's

P

Patrick

I've got an error message in my SQL querry when I'm using
as an example: reponse = "Tunney's Pasture". I'm trying to
match any building's name in my building table to that
name.

Here's my code:

Set rsnew = dbs.OpenRecordset("SELECT * from [t
Warranty] " _
& " WHERE Location = '" & reponse & "' AND " _
& " FiscalYear = '" & fYr & "'")

cpt = rsnew.RecordCount
If cpt = 0 Then
MsgBox "No data available for that building,
printing all!"
GoTo skipToFullDataShow
else.....

Now, I know that its a problem with the ' symbol. Because
I tried-it without the symbol and it works just find.

His there a way to make the SQL understand that this
symbol his part of my querry and not the end of it!!!

Can someone help me!!

Patrick....
 

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