I have a form with a subform.
The form has a combo box, and combo box pulls from a table of patient names, specifically the last name. I use this form to either type the last name of the patient or (obviously) use the pull down feature to look for the last name in the list.
I have this code that will reveal in the subform all the patients with the last name.
Works beautifully for any name that doesn't have an apostrophe. If there is a last name with an apostrophe (O'Henry - names like that), I get a 3075 run time error -- I suspect because the name has the apostrophe.Private Sub cboNameSelector_AfterUpdate()
Dim myName As String
myName = "Select * from tbl_PatientsRecord where ([LastName] = '" & Me.cboNameSelector & "')"
Me.tbl_PatientsRecord_subform1.Form.RecordSource = myName
Me.tbl_PatientsRecord_subform1.Form.Requery
End Sub
How can I get around this?