Combo Box error on Names with ' like O'Brien

From: Sandy (anonymous_at_discussions.microsoft.com)
Date: 02/28/04


Date: Sat, 28 Feb 2004 09:21:05 -0800

I created a combo box based on Name which is a field created by joining last name, first name as follows

Name: [Name-Last] & ", " & [Name-First]

I am getting a Run-time error'3077' Syntax error (missing operator) in expression when I select a name with an ' like O'Brien. The combo box works fine for all other names.

The code created for this combo box is

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

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

The error line is the rs.FindFirst "[Name] = '" & Me![Combo56] & "'"

Any ideas on how to correct this?



Relevant Pages