General discussion
May 26, 2005 at 02:05 AM
munrrob

Error 3075 due to apostrophe

by munrrob . Updated 21 years, 3 months ago

I am using Access VBA to create a recordset. The code works fine until I try to read in a field containing the name O’ Donnell. I get the above error (due to the apostrophe). My code to open the recordset is:

strStaff = “SELECT * FROM tblStaff” _
& ” WHERE [tblStaff]![stfForename] =” & Chr(39) & rsMailingList![First] & Chr(39) _
& ” AND [tblStaff]![stfSurname] = ” & Chr(39) & rsMailingList![Last] & Chr(39) & “;”
Set rsStaff = db.OpenRecordset(strStaff, dbOpenDynaset, dbOpenDynamic)

How do I get around the problem?

This discussion is locked

All Comments