Easy (I think) Drop Down Box Question

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

This question has probably been asked a hundred times, but I have searched
and searched and can't find the answer in here or in Access help.

How do I allow data entry in myy drop down box? (So people can add to it
without going into the table).

Thank you!
Tanya Lee
 
If the data that you see in the combo is actually the data in the table
(i.e. the combos does not have a hidden bound column), you can use its
NotInList event procedure to programmatically add the data to the table.
Details in:
NotInList: Adding values to lookup tables
at:
http://allenbrowne.com/ser-27.html

If the combo does have a hidden bound column, or if there are other fields
you need to add to the lookup table as well, you might consider using the
DblClick event of the combo to open the form where these entries are made.
That's just a matter of using the OpenForm action/method in the DblClick
event. But once the new entry is added, you need to Requery the combo so it
learns about the new entry. Use the AfterUpdate event of the entry form. The
line of code would be:
Forms.Form1.Combo1.Requery
 
Tanya,

You may either set the Limit to List property to No, or set it to Yes and
use the On Not In List event to run a procedure that will allow the addition
to be made. I recommend the latter as it makes the user confirm that he
truly want to add the item to the list.

See the following link for code:

http://www.functionx.com/vbaccess/articles/notinlist.htm

Sprinks
 
Thank you, I will look at both suggestions and see which one works for me.
Tanya Lee
 
I went to your webpage and followed your instructions but it won't work for
me. Can you explain the purpose of creating the module in Step 1? I don't see
how that module is used again (I'm unfamiliar with modules and what they do).
Am I missing something I'm supposed to do?

My dropdown box will now allow me enter a new item, but it does not save it
to the table.

Thank you again!
 
We suggest that you save the function in a standard module, so it can be
used for any combo on any form in the database.

The function saved in that module is called by the line of code in step 5.
 

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