G
Gideon
I used the Wizard to create a combo box to find a record. It made the
following code:
=========================================================
Private Sub CompanyCombo_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[COMPANY] = '" & Me![CompanyCombo] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub
==========================================================
It works fine except when trying to find a record of a company with an
apostrophe, i.e. --> ' <-- (a single quotation mark)
It gets stuck in the statement:
rs.FindFirst "[COMPANY] = '" & Me![CompanyCombo] & "'"
The reason for the error is quite clear: It is due to the apostrophe in
the company name.
Is there an elegant way to solve this problem?
Thanks
Gideon
following code:
=========================================================
Private Sub CompanyCombo_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[COMPANY] = '" & Me![CompanyCombo] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub
==========================================================
It works fine except when trying to find a record of a company with an
apostrophe, i.e. --> ' <-- (a single quotation mark)
It gets stuck in the statement:
rs.FindFirst "[COMPANY] = '" & Me![CompanyCombo] & "'"
The reason for the error is quite clear: It is due to the apostrophe in
the company name.
Is there an elegant way to solve this problem?
Thanks
Gideon