I have a combobox who's values change the recordsource of the form.
Within this form, there is a subform, whos records also need to change
pending the value in the combobox. I am able to get the main forms
values to change, but not the subform. I've only been using Access 97
for about a month now, so it might be fairly simple. Here is my code:
Private Sub combo1_Change()
If Me.combo1.Value = "Standard Procedures" Then
Me.RecordSource = "tbl_stdPro c"
ElseIf Me.combo1.Value = "Policy" Then
Me.RecordSource = "tbl_policy "
ElseIf Me.combo1.Value = "Process Description" Then
Me.RecordSource = "tbl_ProcDe sc"
ElseIf Me.combo1.Value = "Program Description" Then
Me.RecordSource = "tbl_ProgDe sc"
ElseIf Me.combo1.Value = "Training Program" Then
Me.RecordSource = "tbl_TrainP rog"
ElseIf Me.combo1.Value = "Qualificat ion" Then
Me.RecordSource = "tbl_Qual"
ElseIf Me.combo1.Value = "Standard / Specification" Then
Me.RecordSource = "tbl_StdSpe c"
End If
' Everything up to this point works fine. The problem starts below
Me![frm_Type_sub].SetFocus
If Me.combo1.Value = "Standard Procedures" Then
Me.RecordSource = "tbl_stdProc_su b"
ElseIf Me.combo1.Value = "Policy" Then
Me.RecordSource = "tbl_policy_sub "
ElseIf Me.combo1.Value = "Process Description" Then
Me.RecordSource = "tbl_ProcDesc_s ub"
ElseIf Me.combo1.Value = "Program Description" Then
Me.RecordSource = "tbl_ProgDesc_s ub"
ElseIf Me.combo1.Value = "Training Program" Then
Me.RecordSource = "tbl_TrainProg_ sub"
ElseIf Me.combo1.Value = "Qualificat ion" Then
Me.RecordSource = "tbl_Qual_s ub"
ElseIf Me.combo1.Value = "Standard / Specification" Then
Me.RecordSource = "tbl_StdSpec_su b"
End If
End Sub
From searching the archives, it seems like I need to set the focus to
the form on one line, then to the object on another, but I'm not sure
how to do so.
So to sum up my problem: Using a combobox in a form, how do I change
the subforms recordsource?
Thanks in advance!
Stuart K