Combo Box - Not In List

G

Guest

I have a form which contains a Combo Box. Limit to List is set to Yes.
I want to set the NotInList property to ask the user if they want to add,
and if they do then add the new entry in a table that the Combo Box is based
on.

Rookie Question - how do I add the new entry to the table which is contained
in the same database?

Thank you.
 
A

Allen Browne

If (a) the combo's Bound column is the display column (not zero width), and
(b) it is the only field you need to get user input for, you can do it like
this:
Adding values to lookup tables
at:
http://allenbrowne.com/ser-27.html

If you don't meet both those conditions, you might be better to forget the
NotInList event. Instead use the DblClick event of the combo (or place a
command button beside it) to open another form bound to the combo's lookup
table, so the user can add the new record there. Then in the AfterUpdate (or
AfterInsert) event of that form, Requery the combo on your original form so
it hears about the new record.

In Access 2007, combos have a property that defines the form to use to
manage the items in the list. If you enter the form name for this property,
you can right-click the combo to add new items (no code needed.)
 

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

Similar Threads


Top