Not in List Event

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top