How to modify the list in a combo box field ?

D

Dr Alok Modi MD

I have placed a combo box on one of my forms which will pull data from the
related table.
I have two problems:
1. I have read that the difference between a combo box and a list box is
that a list box allows you to only select from a list of data, but a combo
box allows you to add to that or edit to the list. But when I see the drop
down menu in the combo box, there is no place to add or enter the data. How
do I do this?
2. Is a combo box workable only when it pulls data from a many side of the
one to many relationship or it can also pull data on a form of the table
which is the many side of a one to many relationship?

Thanks

Dr Alok Modi MD
 
W

Wayne Morgan

1) True, there is no NotInList event for a list box. There are other
differences between the two, such as a listbox can be set to select more
than one item in the list at a time. To add the data to the combo box, type
it into the textbox portion of the combo box and use code in the NotInList
event to add the data to the table underlying the combo box's Row Source.

2) A combo box is frequently used to pull data from a "lookup" table. You
would have the text description field from the lookup table displayed in the
combo box for the user to see, but would store the unique ID field from the
lookup table in the form's table. You do this by setting the combo box's
Control Source to the form's field that you want to store the data in and
setting the combo box's Bound Column to the column that contains the ID
field.

For an example of using the NotInList event, check here:
http://www.mvps.org/access/forms/frm0015.htm
 
D

Dr Alok Modi MD

Wayne Morgan said:
1) True, there is no NotInList event for a list box. There are other
differences between the two, such as a listbox can be set to select more
than one item in the list at a time. To add the data to the combo box, type
it into the textbox portion of the combo box and use code in the NotInList
event to add the data to the table underlying the combo box's Row Source.

2) A combo box is frequently used to pull data from a "lookup" table. You
would have the text description field from the lookup table displayed in the
combo box for the user to see, but would store the unique ID field from the
lookup table in the form's table. You do this by setting the combo box's
Control Source to the form's field that you want to store the data in and
setting the combo box's Bound Column to the column that contains the ID
field.

For an example of using the NotInList event, check here:
http://www.mvps.org/access/forms/frm0015.htm
I did that Wayne. But I am not able to enter data in the combo box. When i
do that I get an error message. I wish I could uplift my access file for you
to analyse. Can I do that? How do I do it?

Thanks!!
 
W

Wayne Morgan

Yes, if it comes down to it, I'll give you an address to send to. But, let's
try something first. You say you get an error message when you type into the
combo box. What is the error? Does it occur as soon as you start typing or
when you leave the combo box?
 

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