Combo Box - Event Not in List

X

xpnovice

Hi,

Access 2000/2002

On my customer details form I have a combo box which is used to find a
customers surname and customer reference number and then display the related
customer details etc. This all works fine.

I want to add a macro to the "Not in List" event to bring up a message box
whenever an unregistered surname/ref number is entered. From this message
box the user will then opt to open a new customer account form or cancel the
find action.

The macro and message box work fine, but because I still have the unlisted
data in the combo text box I get the default message box "The text you
entered isn't an item in the list" requiring the user to click the OK button
and the Esc key to clear the unlisted data.

Is there any way I can I include an action in my macro (or some other means)
to clear the unlisted data from the combo text box to free the event
without the user needing to manually OK the default message box and then
delete the unlisted name from the combo text box.?

Thanks
John
 
G

Guest

The NotInList event has a Response parameter. Setting this to 0 will stop the
"The text you entered isn't an item in the list" from appearing. See below
for a quick example of how it can be used

Andy W

Private Sub Combo0_NotInList(NewData As String, Response As Integer)
MsgBox "" & NewData " is not in the list!"
Response = 0
End Sub
 
X

xpnovice

Thanks Andy,

That procedure has stopped the msg box appearing as I wanted. However, I
still have the problem of manually deleting the invalid surname entered in
the combo box before I can continue. Any suggestions as to how I can do
this automatically through my procedure?

Thanks
John
 

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