I am trying to implement NotInList to add new item in Combo box. This is working for add new item without quotation sign. I need to add item with quotation sign for new Item but its giving problem that value are in not in list item.
The quotation sign i am using for Inch. I can't used any substitute for quotation sign.
I am using the code from microsoft site
I am using SQL Server 2005 and Access 2003 Access Data Project.
e.g, Item 1 1x1"
Private Sub CustomerID_NotInList (NewData As String, Response As _
Dim Msg As String
Dim CR As String
CR = Chr$(13)
' Exit this subroutine if the combo box was cleared.
If NewData = "" Then Exit Sub
' Ask the user if he or she wishes to add the new customer.
Msg = "'" & NewData & "' is not in the list." & CR & CR
Msg = Msg & "Do you want to add it?"
If MsgBox(Msg, vbQuestion + vbYesNo) = vbYes Then
' If the user chose Yes, start the Customers form in data entry
' mode as a dialog form, passing the new company name in
' NewData to the OpenForm method's OpenArgs argument. The
' OpenArgs argument is used in Customer form's Form_Load event
DoCmd.OpenForm "Customers", , , , acAdd, acDialog, NewData
' Look for the customer the user created in the Customers form.
Result = DLookup("[CompanyName]", "Customers", _
"[CompanyName]='" & NewData & "'")
If IsNull(Result) Then
' If the customer was not created, set the Response argument
' to suppress an error message and undo changes.
Response = acDataErrContinue
' Display a customized message.
MsgBox "Please try again!"
' If the customer was created, set the Response argument to
' indicate that new data is being added.
Response = acDataErrAdded