captphan
Programmer
- Jan 24, 2007
- 42
I have created a combo box I wish to limit to list. If the user adds a value that is not in the list I am using NotInList Property to give the user the choice of adding the item or leaving the field blank.
However I still get a system generated error telling me the item is not in the list. How can I surpress this msg?
Code:
Private Sub SupplyID_NotInList(NewData As String, Response As Integer)
On Error GoTo SupplyID_NotInList_Err
Select Case MsgBox("This item is not in the list do you wish to add it?", vbYesNo Or vbQuestion Or vbSystemModal Or vbDefaultButton1, "ADD PO")
Case vbYes
DoCmd.OpenForm "AddItem", , , , , acDialog, oaADDONLY
Me.SupplyID.Requery
Case vbNo
Me.SupplyID.Undo
Me.SupplyID.Dropdown
'In addition to the above I have tried
' Me.SupplyID.Value = ""
' Me.SupplyID.Value = Null
End Select
SupplyID_NotInList_Exit:
Exit Sub
SupplyID_NotInList_Err:
Select Case Err.Number
Case Else
MsgBox Err.Number & " " & Err.DESCRIPTION & Chr(13) & "In Sub SupplyID_NotInList"
DoCmd.SetWarnings False
DoCmd.RunSQL "INSERT INTO ErrorLog ( ErrNumber, ErrDescription, ErrFunction, ErrDateTime, ErrLine, ErrModule )SELECT " & Err.Number & "," & Chr(34) & Err.DESCRIPTION & Chr(34) & " , 'SupplyID_NotInList', # " & Now() & "#, " & Erl() & " , 'Form_AddReceiptFrm';"
DoCmd.SetWarnings True
Resume SupplyID_NotInList_Exit
End Select
End Sub
However I still get a system generated error telling me the item is not in the list. How can I surpress this msg?