Not In List - Replace Standard error msg with custom msgbox

G

Guest

Hi all,
I added a custom msgbox to the notinlist event of a combo box, but I can't
figure out how to get rid of the built in error message.

Private Sub cboAddress_NotInList(NewData As String, Response As Integer)

MsgBox "The address you typed is not in the city." & Chr(13) & "Please
check the spelling. If address should be in list, please call:" & Chr(13) &
"Joe Blow at 333-0000 or e-mail (e-mail address removed)", , "Not in List"
Me!cboAddress.Value = ""

End Sub

I would like to do this in code because I will be sharing it with other
programmers throughout the organization

Access 2002 SP3
 
J

John Spencer

Yeah, the proper response is hard to find in vba help

You need to set Response argument to one of three values
acDataErrDisplay - displays the default message to the user
acDataErrContinue - does not display the default message to the user
acDateErrAdded - Doesn't display a message to the user but enables you to
add the entry to the combo box list in the NotInList event procedure. After
the entry is added, Microsoft Access updates the list by requerying the
combo box. Microsoft Access then rechecks the string against the combo box
list, and saves the value in the NewData argument in the field the combo box
is bound to. If the string is not in the list, then Microsoft Access
displays an error message

I found it by typing NotInList in the keywords box and then clicking on the
item
NotInList Event - Event Procedures
 

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

Top