Code Error

S

Sandy

The following is apparently a known problem in access 2003 - an apostrophe
in the combo box item causes an error - how is it corrected?

Sandy

Private Sub Combo32_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[Title] = '" & Me![Combo32] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub
 
R

Rob Parker

You can use a pair of double-quote characters as your string delimiter:
rs.FindFirst "[Title] = """ & Me![Combo32] & """"

Expanded for clarity, that is:
rs.FindFirst "[Title] = " " " & Me![Combo32] & " " " "


HTH,

Rob
 
S

Sandy

Perfect Rob - Thank You
Sandy

Rob Parker said:
You can use a pair of double-quote characters as your string delimiter:
rs.FindFirst "[Title] = """ & Me![Combo32] & """"

Expanded for clarity, that is:
rs.FindFirst "[Title] = " " " & Me![Combo32] & " " " "


HTH,

Rob

Sandy said:
The following is apparently a known problem in access 2003 - an
apostrophe in the combo box item causes an error - how is it corrected?

Sandy

Private Sub Combo32_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[Title] = '" & Me![Combo32] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top