Jenkins
asked on
Set recordsource of a subform using code
I have a bunch of queries. Which one will be executed depends on the date range the user enters in a couple of textboxes on a form. How would I modify the code below to set a SUBFORM's recordsource? The code below was used on another one of my projects where I set the FORM's recordsource. This time, I need to set the SUBFORM's recordsource. The subform's name is SUBFORM1. Thank you.
QueryNameForReport = QueryName
If (IsNull(ANYDATA)) Then GoTo NoDataMessage
DoCmd.OpenForm "Form1"
Set frm = Forms("Form1")
With frm
.RecordSource = QueryName <------ (QueryName is a variable that is set to the name of the
appropriate query based upon which date range a
user selects)
QueryNameForReport = QueryName
If (IsNull(ANYDATA)) Then GoTo NoDataMessage
DoCmd.OpenForm "Form1"
Set frm = Forms("Form1")
With frm
.RecordSource = QueryName <------ (QueryName is a variable that is set to the name of the
appropriate query based upon which date range a
user selects)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER