ThomasLafferty
Instructor
Hi!
I have an option group named QueryDriverGroup on a subform embedded in a main form named Drivers, and I want to use it to apply one of three queries as a recordsource for my main form.
I looked over faq181-447 concerning subform syntax and wasn't able to find a line that would work.
My thought was:
I do not get an error, but it doesn't apply the datasource either. Ideas?
Thanks!
Live once die twice; live twice die once.
I have an option group named QueryDriverGroup on a subform embedded in a main form named Drivers, and I want to use it to apply one of three queries as a recordsource for my main form.
I looked over faq181-447 concerning subform syntax and wasn't able to find a line that would work.
My thought was:
Code:
Private Sub QueryDriverGroup_AfterUpdate()
'apply a different data source according to user choice
On Error GoTo Err_QueryDriverGroup_AfterUpdate
Select Case Me.QueryDriverGroup.Value
Case Me.QueryDriverGroup.Value = 1 'default: Heavy Haul
Me.Parent.RecordSource = "qryDriverGroup_HeavyHaul"
Case Me.QueryDriverGroup.Value = 2 'local drivers
Me.Parent.RecordSource = "qryDriverGroup_Local"
Case Me.QueryDriverGroup.Value = 3 'all employees
Me.Parent.RecordSource = "qryDriverGroup_All"
Case Else 'shouldn't happen, only 3 values
End Select
'Apply the user's choice
Me.Parent.Requery
Exit_QueryDriverGroup_AfterUpdate:
Exit Sub
Err_QueryDriverGroup_AfterUpdate:
MsgBox Err.Description
Resume Exit_QueryDriverGroup_AfterUpdate
End Sub
I do not get an error, but it doesn't apply the datasource either. Ideas?
Thanks!
Live once die twice; live twice die once.