Add to a dropdown list

H

HankL

I am using Access 2003
It has been quite some time since I have made changes to a database and
forgot how to enter new selections.
I have a database for restaurants. One of my dropdown boxes allows me to
select Type Food, such as American, Italian, etc.
I want to add other ethnic food types and forgot how to do this.

Could someone please give me instructions to add additional food types to my
dropdown list.
Please make it simple as it is difficult for me to follow very technical
explanations.
 
F

fredg

I am using Access 2003
It has been quite some time since I have made changes to a database and
forgot how to enter new selections.
I have a database for restaurants. One of my dropdown boxes allows me to
select Type Food, such as American, Italian, etc.
I want to add other ethnic food types and forgot how to do this.

Could someone please give me instructions to add additional food types to my
dropdown list.
Please make it simple as it is difficult for me to follow very technical
explanations.

There are several methods. Here is one.
First set the Combo box LimitToList property to Yes.
Then, assuming that the TypeFood value is text, not number, code the
combo box NotInList event:

If MsgBox("Add this food type?", vbYesNo) = vbYes Then
Dim strTemp As String
strTemp = "INSERT INTO TableName ( [FieldName] ) " & _
"Values (""" & NewData & """)"
CurrentDb.Execute strTemp, dbFailOnError
End If
 
M

Mr. B

Fred has assumed that the current values for your combo box are comming from
a table and he is quite correct about how to add to the list if this is the
case.

However, there is the possiblity that the values that you see in the combo
box may be "hard coded", meaning that the values may be just a list of values
and not stored in a table.

To check this, open your form in design view. Select the combo box in
question. Display the "Properties" dialog box for the combo box. Look at
the "Data" tab of the "Properties" dialog box. I the "Row Source Type" is
set to "Value List" then you will see the actual list of values listed in the
"Row Source" with each value being seperated by a semi colon. You can add
additional values by typing in the values you need, seperating each one with
a semi colon.

This may not apply to your situation, but I was worth looking at.

-----
HTH
Mr. B
http://www.askdoctoraccess.com/
Doctor Access Downloads Page:
http://www.askdoctoraccess.com/DownloadPage.htm
 
J

Jeff Boyce

.... and here are some considerations ...

If you use a table to store the list (the preferred method), adding to the
list requires NO recoding and very little maintenance. You only have to add
a record to the lookup table.

If you use a value list, you WILL have to find the list and modify it. It
would be a good idea to test afterwards, too.

That said, many folks find keeping a list in a table to be much easier than
maintaining a list in the combobox's properties.

Good luck!

Regards

Jeff Boyce
Microsoft Access MVP

Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or psuedocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.
 

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