Populating combo box and updating table

  • Thread starter Thread starter Ohaya
  • Start date Start date
O

Ohaya

Hi,

My MS Access application has a main/menu form, which executes a data
entry form.

The data entry form has a combo box on it that I configured to be filled
from a different table.

I was looking at the code in the data entry form, and was wondering
how/where the combo box gets populated, i.e., where is the code that
populates this combo box when the data entry form gets started? I was
kind of expecting some code in the Form_Load event of the data entry
form, but there doesn't seem to be anything there.


Going "the other way around", based on what happens in my data entry
form, I want to be able to update one of the fields in the table that
was the original source for populating the combo box. How do I do
this??

Thanks in advance,
Jim
 
Ohaya,

Combo boxes can be connected to two data sources; one of the list
(drop-down) portion, and one for the textbox (value) portion.

They get their list-portion data from a table, query or hard-coded list
that's specified in its RowSource property. The RowSourceType property tells
you which.

When you select one of the values in the list-portion, the value is stored
in the combo's Value property. If thye combo is bound to an underlying
table/query (usually the one to which the form is also bound), you'll see
that its ControlSource property contains the name fo the field to which it
is bound. If the ControlSource property is empty, we say that the control is
"unbound", meaning, its data is NOT saved anywhere.

When you navigate to a record, Access automatically (without any extra code)
populates the list-portion using the details specified in the RowSource and
RowSourceType properties. The actual value that was stored for this control
when the record was saved, is returned to the Value property from the source
defined by its ControlSource property, which may be a table/query field, or
calculation. If the control is unbound, the Value property remains blank.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia

Microsoft Access 2003 VBA Programmer's Reference
http://www.wiley.com/WileyCDA/WileyTitle/productCd-0764559036.html
 
Graham,

Thanks.

You didn't respond to the last part of my post, about how to update the
field in the table that was the source of the combobox data, but I
figured that one out. What I did was do a DoCmd.RunSQL with an UPDATE
query on the source table. Worked like a charm.

Again, thanks!

Jim
 
Back
Top