Combo Box - NotInList

  • Thread starter Thread starter Stapes
  • Start date Start date
S

Stapes

Hi

I am trying to use a Combo box to allow a user to choose an existing
Company name & address, or add a new one. The bound column is the
Company name. I have used the NotInList property and put in an event
procedure here. The trouble is, it never gets activated. I have
entered names that are not on the list. Also, one name I am trying to
enter is CONTAINED within another name, i.e. I want to enter "Home",
but "Home Delivery Network" already exists. The rest of "Home Delivery
Network" appears in the Combo Box, but I delete it. Still doesn't
trigger my event procedure.

Any idea why this is happening?

Stapes
 
Stapes said:
Surely you mean set the LimitToList property to No? I have already
done that.

No, I meant True (Yes if you're doing it through the Properties window).

The NotInList event doesn't fire unless you've told Access that you only
want to use values that are in the combo box.
 
No, I meant True (Yes if you're doing it through the Properties window).

The NotInList event doesn't fire unless you've told Access that you only
want to use values that are in the combo box.

Hi Again

OK. I set my LimitToList property to True. My NotInList event gets
triggered & does what it's told - i.e. displays a message asking the
user to input address details. But then, I get the message "The text
you entered isn't an item in the list" and the focus has gone back to
that field.
If the item does not exist in the list - I want to create a new
customer record.

Stapes
 
Stapes said:
Hi Again

OK. I set my LimitToList property to True. My NotInList event gets
triggered & does what it's told - i.e. displays a message asking the
user to input address details. But then, I get the message "The text
you entered isn't an item in the list" and the focus has gone back to
that field.
If the item does not exist in the list - I want to create a new
customer record.

What's the code you've got in your NotInList event?

Assuming that you've already got a customer creation form, your NotInList
event should prompt the user to ensure that they really do want to add a
record (in case it was just a typo) and then open the customer creation form
modally (i.e.: use the acDialog constant in conjunction with the OpenForm
method). The "trick" is to know when they've actually created a new customer
vs. when they've decided to cancel the creation process for some reason.
What I often do is create a property on the calling form (something like
"RecordAdded") and set it to False before calling the creation form. When I
call the creation form, I pass it the name of the form that's calling it. In
the Click event of the Close button on the creation form, I put logic that
determines whether or not the form was called from another form (i.e.: I
check the form's OpenArgs property) and update the RecordAdded property of
the calling form. In the calling form's NotInList event, I can then check to
see the value of RecordAdded., and set the value of Response appropriately.
 

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