Combo Box Error

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ielamrani
    New Member
    • Feb 2007
    • 72

    Combo Box Error

    Hi,
    I created a combo box to filter client name. The combo box is working fine except on this case:
    when I filter one of these name:
    David's Financial or Rao's Specialty
    I get this error:

    Code:
    Private Sub Combo170_AfterUpdate()
        ' Find the record that matches the control.
        Dim rs As Object
    
        Set rs = Me.Recordset.Clone
        [B]rs.FindFirst "[Client Name] = '" & Me![Combo170] & "'"[/B]
        If Not rs.EOF Then Me.Bookmark = rs.Bookmark
    End Sub
    I believe the error comes up because the names have an Apostrophe (').

    Anyone have any idea
    Thank you in advance
    Last edited by NeoPa; Mar 7 '07, 03:06 AM. Reason: Tags for Layout
  • dorinbogdan
    Recognized Expert Contributor
    • Feb 2007
    • 839

    #2
    Code:
    rs.FindFirst "[Client Name] = '" & Replace(Me![Combo170], "'", "''") & "'"

    Comment

    • ielamrani
      New Member
      • Feb 2007
      • 72

      #3
      Great. Thank you.

      Comment

      Working...