I have looked everywhere for a solution to this and I always get that same answer, set the RecordSource property of the form with FormName.RecordSource = "RecordSource", however, when I do this, I get nothing from my form.
Here is some background. I created a form using the wizard and associated it with one of the "representative" queries that the record source could be set to. After creating the form, I deleted the data source, so that I could set the supporting query at runtime.
However, I get no reaction from the form at all when I do this. Here is an example of my code.
Do I need to change the data source of each control at runtime as well, or should it automatically adjust to the new record source.
Here is some background. I created a form using the wizard and associated it with one of the "representative" queries that the record source could be set to. After creating the form, I deleted the data source, so that I could set the supporting query at runtime.
However, I get no reaction from the form at all when I do this. Here is an example of my code.
Code:
Private Sub LoadNav()
Dim strSQL As String
If currentUser = "AC" Then
Form_frmNavigation.lblCurrentUser.Caption = "Alex Chavers' Associated Tasks"
Me.RecordSource = "qryACEA"
ElseIf currentUser = "PH" Then
Form_frmNavigation.lblCurrentUser.Caption = "Paul Herring's Associated Tasks"
Me.RecordSource = "qryPHEA"
ElseIf currentUser = "DK" Then
Form_frmNavigation.lblCurrentUser.Caption = "Donald Brown's Associated Tasks"
Me.RecordSource = "qryDBEA"
End If
Form_frmMain.RecordSource = Me.RecordSource
End Sub
Do I need to change the data source of each control at runtime as well, or should it automatically adjust to the new record source.