Limit to List Dropdown

D

Dave Ruhl

Hi, I have a combo box with 'Limit to List' set
to 'YES'. This is a list of customer names, and there is
a button on the form to add a new customer if not already
on the list (it opens another form)

This combo box is in a continuous-forms subform, whic is
used to add customers to a mailing list. When users try
to enter invalid data they get the standard "This item is
not in the list...blah, blah, blah" message. Many of our
users then use the backspace key to delete what they have
entered, and then try to click the 'Add New Customer'
button.

The problem is that they have added a blank record with a
null value in a required field, and when they try to
leave that field they get the "You tried to assign a Null
value to a field that is not variant type..." error
message. Simply hitting the ESC key a few times, or CTRL-
Z will delete the added record, but I can't figure out
how to trap this error and either A) delete the null
record for them or B) show them a message telling them to
hit ESC a few times.

I've tried to use the 'On Not in List', 'On Dirty', 'On
Change', and 'On Lost Focus' events to trap this error
with no luck. Can this be done ? Thanks...

Dave
 
R

Roger Carlson

You can trap the error in the OnError event of the Form. I think the error
number is 3314.
 
D

Dave Ruhl

DOH! I didn't even think of trapping it at the form
level - was just concentrating on the control.

Thanks Roger, you put me on the right track. The error
numbers are 2237 (not in list) and 3162 (null value) and
I will be able to handle them the way I want.

(Love your website - been there many times. Thanks
again!)

Dave
 
Top