add but not edit combo box

J

JR

I want form users to be able to add to the source of the combo box dropdowns,
but not to be able to edit the existing values.

How can I do this?

Thanks!
 
B

Brian

What source are you using? Are the form & combo box bound to a table & field?

I sometimes set the RowSource of a combo box to the same field as the
ControlSource, but use a SELECT DISTINCT... in the RowSource query to avoid
duplicates in the combo box, then make LimitToList False. This gives the user
the option of selecting from previously-used entries or entering a new one
that becomes part of the new dropdown list.

This, however, assumes that the list will not have pre-existing members and
will be built as users enter data. That is, the first record input will have
nothing in the combo box, so the user simply enters it manually. The next
record will have the first entry as an option, with the option for the user
to simply type something else. If he types something else, that also becomes
part of the dropdown list; if he types the same thing, the SELECT DISTINCT
prevents it from appearing twice.

Now, if you want to have a pre-populated list but want users to be able to
add their own entries, you could just make a separate table that contains the
elements they will choose in that combo box and have the users maintain that
source on another bound form. You would just have to disallow edits on that
other form, but that could be a problem if someone mistypes.

If you want to get both, you could make an administrative table of the
pre-populated entries and set up a UNION (which will avoid duplicates, unlike
UNION ALL) query that selects from your pre-populated table and the field in
the ControlSource of the combo box. That would essentially allow users to add
entries on the fly without being able to touch your predefined set of
dropdown source members.

Carefully consider, though, the possibility that different users may come up
with different (mis)spellings for the same thing, so try to avoid LimitToList
False if the contents of the field will be important as report filters, etc.
It can become difficult to merge data later.
 
M

Mr. B

JR,

Take a look at this link.

http://www.mvps.org/access/forms/frm0015.htm

If you want to keep and maintain quality data you really do not want to set
the Limit to List as false for any combo box. You can add to lists without
having to have any other bound forms. You can add records and values to list
through the user of record sets that are created and updated using in VBA
code.

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

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