I am trying to filter a recordset.
ie rstSetName.Filter = "KEYFIELD = '" & varName & "'"

My problem: if there is a ' or a " in varName it ends the string for my filter and messes it up. I have been told to do something like this.

rstSetName.Filter = "KEYFIELD = '" & replace(varName, "'", "''" & "'")

This does stop the filter from crashing, however it doesn't really solve my problem because the filter is incorrect, and doesn't find the data I want it to. I have been scratching my head over this one for a while, so any help would be super cool!