Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2004
    Posts
    5

    Unanswered: ' character in a dropdown box

    Hi,
    I have a dropdown box that has a text field as the control source.
    LimitToList set to No.
    When the user tries to enter the following: Hopper's
    he gets the following error message:
    "Syntax error (missing operator) in query expression: '[to] = 'Hopper's".
    Is there a way to allow the ' character in this string?
    Thanks,
    John

  2. #2
    Join Date
    Aug 2004
    Posts
    5
    More Details:
    The problem is in the toCombo_AfterUpdate procedure.
    Here is the code:
    +++++++++++++

    Dim Result
    Result = DLookup("[to]", "toTbl", "[to]='" & Me![toCombo] & "'")
    If IsNull(Result) Then
    ' Ask the user if he or she wishes to add the new subdivision.
    Msg = Me![toCombo] & " is not in the list." & CR & CR
    Msg = Msg & "Do you want to add him/her?"
    If MsgBox(Msg, vbQuestion + vbYesNo) = vbYes Then
    ' If the user chose Yes, add the new person to the table.
    DoCmd.OpenForm "setupToFrm", acNormal, , , , acWindowNormal
    DoCmd.GoToRecord acDataForm, "setupToFrm", acNewRec
    Forms![setupToFrm]![to] = Me![toCombo]
    Me.Refresh
    End If
    End If
    ++++++++++++++++
    The problem is with the following line:

    Forms![setupToFrm]![to] = Me![toCombo]

    Thanks,
    John

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •