Stopping Automatic Message Box

  • Thread starter Thread starter Keith Willcocks
  • Start date Start date
K

Keith Willcocks

I am using some Combo Boxes and in a number of them I am using the NotInList
property to bring up a customised message box. This works fine but my
message box is followed by another automatic one giving the standard error
message. How can I prevent this second message box from appearing? I am
sure that I am probably overlooking the obvious.

Here is an example of the code:

Private Sub cboMRproductType_NotInList(NewData As String, Response As
Integer)
MsgBox ("Selection not recognised, you must select an item from the
list. To abandon the record click Cancel.")
End Sub
 
I am using some Combo Boxes and in a number of them I am using the NotInList
property to bring up a customised message box. This works fine but my
message box is followed by another automatic one giving the standard error
message. How can I prevent this second message box from appearing? I am
sure that I am probably overlooking the obvious.

Here is an example of the code:

Private Sub cboMRproductType_NotInList(NewData As String, Response As
Integer)
MsgBox ("Selection not recognised, you must select an item from the
list. To abandon the record click Cancel.")
End Sub

You have to tell it not to give the default message.

Private Sub cboMRproductType_NotInList(NewData As String, Response As
Integer)
MsgBox "Selection not recognised, you must select an item from
the list. To abandon the record click Cancel."
acDataErrContinue
End Sub

Note: Your code is just giving a message, so there is no need to use
the MsgBox() as a function. Remove the parenthesis to just present the
message.
 
minor slipup by fredg, that should be

response = acDataErrContinue

Pieter
 
Many thanks Fredj and Pieter. The assistance is greatly appreciated.
--
Keith Willcocks


"Pieter Wijnen"
minor slipup by fredg, that should be

response = acDataErrContinue

Pieter
 

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

Back
Top