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?
The problem is in the toCombo_AfterUpdate procedure.
Here is the code:
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]
The problem is with the following line: