comboxes

  • Thread starter Thread starter Ezekiël
  • Start date Start date
E

Ezekiël

Hello,

I can't seem to manage to change the rowsources of the 2 comboboxes. The 2
comboboxes are dependent of each other and both are looking their values up
in 2 related tables.

For example:
-tablename 1: choicelist (= rowsource in combobox 1)
-tablename 2: subchoicelist (=rowsource in combox 2)

Combobox 1 has static values from table 1. The rowsource of combobox 2 is
dynamically changed after choosing a value from combobox 1 (afterupdate
event). This works so far, but when i move to another record where there is
a another value in combobox 1, the value in combobox 2 doesn't change with
it. The value is the same in the previous record.

Does anyone has the answer?
 
Ezekiel,

Do you call the AfterUpdate event for combobox1 when you move to the new
record.

The AfterUpdate event will not fire if you change the content of combobox1
by means other than manually choosing a new value. Try
combobox1_AfterUpdate in the Form_Current event.

Rod Scoullar.
 
Ezekiel,

The AfterUpdate event doesn't fire unless you change a value in the
combobox. When you move to a new record the program changes the value not
you, and the AfterUpdate event won't fire.

Rod.
 
Ezekiel,

The Form_Current event fires whenever a new record is selected (including
when you first open the form). If you put this code in the Form_Current
event:

If Not IsNull(combobox1) Then combobox1_AfterUpdate.

you should find that combobox2 is filled as if you had selected the entry in
combobox1.

The isnull prevents the event firing if there is not a value in combobox1 on
form open.

Rod.
 
Back
Top