The following example code works fine in one of my forms but does not work correctly in two others. My issue arrives when I enter the new data in frmAddSponser and return to the form that called this form. The Response = acDataErrAdded is supposed to requery the combobox and allow you to exit it without retriggering the NotInList even. However, two of my forms still trigger this even while the other does not. I have checked multiple times to verify syntax.
The only difference between the two nonfunctioning events and the one that acts appropriately is that the two nonfuncting are on subforms being called from a form whereas the working event is directly on the form. However, the event does not work properly when I'm on the forms used as subforms either.
This has consumed an inordinant amount of my life and I'm going to put my head through the comp screen soon. Any help is greatly appreciated. Thanks in advance.
--------------------------------------------------------------------------
Private Sub cboSponsorName_NotInList(NewData As String, Response As Integer)
Dim Reply As String
If MsgBox("This Sponsor is not currently part of the Sponsor list. Do you want to add this Sponsor?", vbOKCancel, "Confirm add new Staff Member") = vbOK Then
DoCmd.OpenForm "frmAddSponsor", acNormal, , , acFormAdd, acDialog, NewData
Response = acDataErrAdded
Else
Me!cboSponsorName.Value = Null
Response = acDataErrContinue
End If
Response = acDataErrContinue
Exit Sub
End Sub
The only difference between the two nonfunctioning events and the one that acts appropriately is that the two nonfuncting are on subforms being called from a form whereas the working event is directly on the form. However, the event does not work properly when I'm on the forms used as subforms either.
This has consumed an inordinant amount of my life and I'm going to put my head through the comp screen soon. Any help is greatly appreciated. Thanks in advance.
--------------------------------------------------------------------------
Private Sub cboSponsorName_NotInList(NewData As String, Response As Integer)
Dim Reply As String
If MsgBox("This Sponsor is not currently part of the Sponsor list. Do you want to add this Sponsor?", vbOKCancel, "Confirm add new Staff Member") = vbOK Then
DoCmd.OpenForm "frmAddSponsor", acNormal, , , acFormAdd, acDialog, NewData
Response = acDataErrAdded
Else
Me!cboSponsorName.Value = Null
Response = acDataErrContinue
End If
Response = acDataErrContinue
Exit Sub
End Sub