Sub form requery problem

michaellysons

Registered User.
Local time
Today, 14:52
Joined
May 7, 2004
Messages
11
I have a sub form that displays a list of students. There is a combo box on the sub form that limits the student list to either 'all students' or 'active students'. If I run the sub form on its own it works correctly: I can change the value in the combo box and the list reflects that change. The default for the sub form is to show 'active students'.

I have a main form which has a combo box full of tutors. The sub form described above is also on this main form. If I run the main form and select a new tutor, the sub form is updated correctly with the students relevant to that tutor.

The problem is this: if I select a value from the combo on the sub form, the sub form disappears. I've checked the parameters for the sub form query and they are set, so it should be returning rows.

A code example:

In the sub form

Code:
Private Sub cboShow_Click()

    RefreshForm cboShow.Value

End Sub

Public Sub RefreshMe(ByVal lngShowType As Long)

    Select Case lngShowType

        Case gconComboIDShowStudentsAll
            Me.RecordSource = "StudentListForSpecificTutor-All"

        Case gconComboIDShowStudentsActive
            Me.RecordSource = "StudentListForSpecificTutor-Active"

        Case Else
            Me.RecordSource = "StudentListForSpecificTutor-Active"

    End Select

    Me.Requery

End Sub

I've debugged these processes to ensure the correct record source is being set and it is. I've also checked the parameters just before the record source is changed and they are set.

I'm stumped: wood, trees and I can't either of them.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom