Hi Access experts,
I need to be able to search my Access 2K db using a simple search engine written in VBA. The problem is using a statement like, for ex.,:
when strSname contains, for example: "Joe's Garage."
Obviously, the "'" fubars the strSQL string. I understand that I can go to ADO and use the find method to get around this, or, translate all of the existing data in my large db and get rid of all of the "'"s.
What I want to know is if anyone has a different method of getting around this issue? I'd like to be able to somehow translate the search criteria (i.e., what is contained in strSname) if it has a "'" in it, then run the search as is, and somehow get the search criteria to match existing criteria in the db that could have a "'".
I hope I have made sense. If so, and if you know a work-around, please reply.
Thanks!
JBG
I need to be able to search my Access 2K db using a simple search engine written in VBA. The problem is using a statement like, for ex.,:
Code:
strSQL = "SELECT strStoreName FROM tblStores WHERE strStoreName = '" & strSname & "'"
when strSname contains, for example: "Joe's Garage."
Obviously, the "'" fubars the strSQL string. I understand that I can go to ADO and use the find method to get around this, or, translate all of the existing data in my large db and get rid of all of the "'"s.
What I want to know is if anyone has a different method of getting around this issue? I'd like to be able to somehow translate the search criteria (i.e., what is contained in strSname) if it has a "'" in it, then run the search as is, and somehow get the search criteria to match existing criteria in the db that could have a "'".
I hope I have made sense. If so, and if you know a work-around, please reply.
Thanks!
JBG