JB and Graham, PMFJI, but i'm wondering if the two of you are talking
about
two different scenarios.
Graham, you're talking about populating a combo box droplist with values
that are pulled from the bound field in the form's underlying table,
correct?
JB, do you have a *separate* table of values that you're using to
populate
the combo box? and you want to be able to add new values (records) to
that
"supporting" table during normal data entry, when necessary?
don't mean to stick my nose in, guys, i'm just getting the feeling that
you're talking at cross-purposes and neither one realizes it. or maybe
i'm
all wet, in which case please excuse my intrusion and carry on!
hth
Hi JB
On the first problem (which you appear to have solved

If
ColumnCount
is
1 then ColumnWidths should be blank. It doesn't make sense to allocate
widths for multiple columns of you have only one! If ColumnWidths is
blank
then the column widths will be assigned automatically, and for a single
column that means it will be the same as the width of the textbox.
On the second problem, do you mean that the new values you add don't
appear
in the combo box list until you have closed the form and reopened it?
This
is understandable. After you have saved a record with a new value, you
will
need to requery the combobox so that that new one is included in the
list.
Unfortunately, I can't think of any easy way to tell if the value in
the
combobox is a pre-existing one or not. So perhaps the best way is to
unconditionally requery the combo after an updated record has been
saved
(the AfterUpdate event).
Private Sub Form_AfterUpdate()
Me.YourComboName.Requery
End Sub
--
Good Luck!
Graham Mandeno [Access MVP]
Auckland, New Zealand
It did work, sorry.
I changed the columnwidth from 0cm,2.5cm to 2.5cm,2.5cm
So that works well and I can add and choose. The only thing is when I
checked in the MyField table, it still only listed the original
values
that were there which were 8. I've now added 3 more.
Do I need to change the ListRow property? it says 8 which is the
first
amount before I added more.
Thanks for your patience!
JB
Hi JB
First, *don't* use a combo box in a table. It only serves to
confuse
(the user) and corrupt (the data). A form is for data entry. A
table
is
for data storage.
So, you add a combo box control to your form and set its properties
as
follows:
ControlSource: YourField
RowSourceType: Table/Query
ColumnCount: 1
BoundColumn: 1
LimitToList: No
and here is the main part:
RowSource: Select DISTINCT [YourField] from [YourTable]
where [YourField] is not null order by
[YourField];
The query will list all the non-null values in your field from all
records in the table, and the DISTINCT keyword will prevent
duplicates
being included.
The LimitToList set to No will allow new values to be entered that
are
not already in the table.
--
HTH!
Graham Mandeno [Access MVP]
Auckland, New Zealand
Hi all.
I have tried to find this solution but keep coming up against a
brick
wall.
All I want to do is create a drop-down list in a table or it's form
that, when I enter the data, I can either choose from what is
already
there, or Add to it as I create more records.
In the table I create the field and choose Lookup Wizard and since
I
already created the table, I choose it.
But when I put it in the form it keeps coming up with errors. What
ever
I do to modify it, I get another problem.
It says that I have to choose from list, so I modify the property
to
NOT
limit to list but then it says something about Column width, which
looks
wide enough to me. I've tried changing the bound column and the
width
column but it makes things worse or I don't get a blank list. Or I
choose from the list but it says I can't and comes up with a
number.
The help pages talk in another language and I can't find the
solution.
Crazy thing is I've done this before but I'm just now getting
totally
confused.
Does the dropdown list have to have it's own table?
Does it have to have an ID? and a primary Key?
If so how can I choose the name of the item and not it's ID number?
and most importantly how can I add to the list in the Form I put
the
field in as I go along. So that each new item shows in the dropdown
list
next time?
Please help.
J