Code:
Private Sub cmbInsComp_NotInList(NewData As String, Response As Integer)Dim Result
Dim Msg As String
Dim CR As String
CR = Chr$(13)
Response = acDataErrContinue
' 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
Me.cmbInsComp.Text = ""
' 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
' procedure.
DoCmd.OpenForm "FrmInsComp", , , , acAdd, acDialog, 4
Else
Me.cmbInsComp.Value = ""
End If
End Sub
Code:
Private Sub btnSavClose_Click()Dim InID As Integer
If Me.Dirty = True Then Me.Dirty = False
InID = Me.InsCompID
If InsCompOpt = 1 Or InsCompOpt = 4 Then
Forms!FrmCust!FrmClaims.Form!cmbInsComp.Requery
Forms!FrmCust!FrmClaims.Form!cmbInsComp = InID
Opt = Me.InsCompID
End If
DoCmd.Close acForm, "frmInsComp"
InsCompOpt = 999
End Sub
Thanks ItsMe