I have a form with two comboboxes.
The first cboCoursetype filters the second combox cboQualLevel
The comboboxes are set up to store the information in an underlying table (it is a data entry form).
When the form is first opened, the second box cboQualLevel displays the correct choices of level. e.g. If the Coursetype is University/College the list is
A level or equivalent
The problem is that if you choose say "First degree" the option pops back to A level or equivalent.
If you leave it at this and finish the record and save it and exit and then go back to it you are able to select the correct option e.g. "First degree"
Any hints about what is going wrong here?
Private Sub cboCourseType_AfterUpdate()
Dim sQuallevel As String
sQuallevel = "SELECT [Quallevel].[Coursetypefk]," & _
" [Quallevel].[Quallevel]," & _
" [Quallevel].[Quallevelid] " & _
"FROM Quallevel " & _
"WHERE [Coursetypefk] = " & Me.cboCourseType.Value
Me.CboQualLevel.RowSource = sQuallevel
Because of the way MS Access opens up forms and sets up its objects, you sometimes start off with a badly defined cross-reference between cascaded combo baxes. This might be the case, because everything works OK second time around. You might try setting the first combo box to a default (e.g. A level) and do a filter set and requery on the econd combo box, all in the Form_Open() event.
That sounds like what I need to do.
I am unsure how to correctly code the filter set and requery on the combo box cboQualLevel from the Form_Open() event rather than set the filter on the entire form?