cascading combo box causing empty fields in next record

Posted by glinch on Stack Overflow See other posts from Stack Overflow or by glinch
Published on 2010-04-01T11:44:31Z Indexed on 2010/04/04 0:23 UTC
Read the original article Hit count: 744

Filed under:
|

Hi there,

I'm having problems with a cascading combo box. Everything works fine with the combo boxes and the values get populated correctly.

Private Sub cmbAdjComp_AfterUpdate()
Me.cboAdjOff.RowSource = "SELECT AdjusterCompanyOffice.ID, 
AdjusterCompanyOffice.Address1, 
AdjusterCompanyOffice.Address2, 
AdjusterCompanyOffice.Address3, 
AdjusterCompanyOffice.Address4, 
AdjusterCompanyOffice.Address5 FROM" & _
" AdjusterCompanyOffice WHERE 
AdjusterCompanyOffice.AdjCompID = " & Me.cmbAdjComp.Column(1) & _
" ORDER BY AdjusterCompanyOffice.Address1"
Me.cboAdjOff = Me.cboAdjOff.ItemData(0)
End Sub

The secondary combo box has a row source query:

SELECT AdjusterCompanyOffice.ID, AdjusterCompanyOffice.Address1,    
AdjusterCompanyOffice.Address2, AdjusterCompanyOffice.Address3,
 AdjusterCompanyOffice.Address4, AdjusterCompanyOffice.Address5 FROM 
 AdjusterCompanyOffice ORDER BY AdjusterCompanyOffice.Address1;

Both comboboxes have the same controlsource.

Everything works fine and dandy moving between records and the boxes show the correct fields for each record.

When i use the first combo box, and then select the appropriate option in the second combo box, everything works great on the specific record.

However when I move to the next record, the values in the second combo box are all empty. If i close the form and reopen it, and avoid using the cascading combo boxes all the values are all correct when i move between records.

Somehow using the cascading combo boxes creates a conflict with the row source of the secondary combo box.

Hope that is clear! Have been rummaging around for an answer but cant find anything.

any help would be greatly appreciated.

Thanks

Noel

© Stack Overflow or respective owner

Related posts about ms-access

Related posts about ms-access-2007