Hi David,
Forgive me for not answering the question you asked orginally. If I have
a
combobox on a form, yes the rowsource type would be Value List, and the
rowsource would be the list of the various items. Tim's method would add
the
additional item to that list, but once the form has closed, the newly
added
item isn't retained. In order to retain that item, it must be enter
directly into the table.
Perhaps, it would be better to say, that the Field in this table has the
Display Control set to Combo Box the Row Source Type is set to Value
List
and the Row Source has the list entered like this "Good";"Fair";"Poor".
This
table is not used in the database for any forms or queries or reports.
This
table is uploaded. or read by a hand-held device. Basically the hand held
device is a replicate of this table, so as it synchronizes it matches each
field in the hand-held with what is in this table. So to change what the
hand-held will display after synchronization, I have to go to this table
and
manually enter the changes to the row source of each field in design view
of
the table.
I realize that my question has steered many people to confusion by my
using
the term combo box incorrectly. A combo box is a control used on a form,
and
I was talking about the field in a table. I greatly apologize for my
incorrect terminology.
However my question still is the same, is it possible to change the
rowsource of a Field in a table that has the display control set to combo
box
by using code, rather than opening the table in design view. Typically I
would never ask this kind of question, except the end user has requested
that
when changes are made to the fields on this table, that it be done by not
opening the table in design mode. My initial response was No, it wasn't
possible... but there are many people such as yourself, with a vast amount
of
knowledge and experience at a level far above myself, so I owed it to the
end
user to search further and ask the question and for myself to learn more
in
the process.
Again, I truly apologize for causing so much confusion amoungst the group
here. So if there is an answer whether it be a yes or no, I would greatly
appreciate it.
Many, many thanks to all.
Les
david epsom dot com dot au said:
Tim Ferguson has already shown you how to change a combo box
rowsource where the type is set to Value List.
I asked you this question:
What RowSourceType value and RowSource value do you see if
you look at the Data Properties of that combo box?
You didn't answer.
(david)
Thank you David,
Haven't been able to get the INSERT INTO syntax correctly written yet,
but
I
will keep working at it. Most of the variations seem to add a record
and
not
change the value list of the drop down box in the table that I was
looking
for. Was this code to add a record or to actually change the rowsource
List
of text descriptions for the field that has a combo box with a row
source
type that is set to Value List?
Just this last question if you can answer and then eiher I will figure
it
out, or just scrape the idea totally.
Much appreciated,
Les
:
This is how you add a value to a table:
Codedb.execute "INSERT INTO TableA ( [field1] ) SELECT "Excellent";
This is how you add missing values to a table:
ssql = "INSERT INTO tableA ( [field1] ) " & _
"SELECT tableB.[field1] " & _
"FROM tableB LEFT JOIN tableA " & _
"ON tableB.[field1] = tableA.[field1] " & _
"WHERE (((tableA.[field1]) Is Null));"
Codedb.Execute ssql
(david)