M
Marianne
The code below has two problems. First the Access message is still displayed
after my custom msgbox is displayed, and second, the field CaseName is not
updated from NewData on the form frmCase when it is opened.
What am I missing or doing wrong?
Thanks for any help!
Private Sub cboCaseName_NotInList(NewData As String, Response As Integer)
On Error GoTo Error_Handler
Dim intAnswer As Integer
intAnswer = MsgBox("""" & NewData & """ is not listed. " & vbCrLf & _
"Do you want to add a new Case?", vbYesNo + vbQuestion,
"Invalid Case")
Select Case intAnswer
Case vbYes
DoCmd.SetWarnings False
DoCmd.OpenForm "frmCase", acNormal, , , acFormAdd
DoCmd.SetWarnings True
Response = acDataErrAdded
Case vbNo
MsgBox "Please select a Case from the list. ", _
vbExclamation + vbOKOnly, "Invaid Case"
Response = acDataErrContinue
End Select
Exit_Procedure:
DoCmd.SetWarnings True
Exit Sub
Error_Handler:
MsgBox Err.Number & ", " & Err.Description
Resume Exit_Procedure
Resume
End Sub
after my custom msgbox is displayed, and second, the field CaseName is not
updated from NewData on the form frmCase when it is opened.
What am I missing or doing wrong?
Thanks for any help!
Private Sub cboCaseName_NotInList(NewData As String, Response As Integer)
On Error GoTo Error_Handler
Dim intAnswer As Integer
intAnswer = MsgBox("""" & NewData & """ is not listed. " & vbCrLf & _
"Do you want to add a new Case?", vbYesNo + vbQuestion,
"Invalid Case")
Select Case intAnswer
Case vbYes
DoCmd.SetWarnings False
DoCmd.OpenForm "frmCase", acNormal, , , acFormAdd
DoCmd.SetWarnings True
Response = acDataErrAdded
Case vbNo
MsgBox "Please select a Case from the list. ", _
vbExclamation + vbOKOnly, "Invaid Case"
Response = acDataErrContinue
End Select
Exit_Procedure:
DoCmd.SetWarnings True
Exit Sub
Error_Handler:
MsgBox Err.Number & ", " & Err.Description
Resume Exit_Procedure
Resume
End Sub