CochiseCounty
asked on
Repopulate subreport at runtime.
I have a main report with a subreport. How do I requery the query that used for the subreport everytime the main report is opened?
I have something like this, seems like it works, but the subreport picks the result from the last runtime. How do I make the subreport pick the newest result? My subreport name 'rpt_SubReport'. Thanks for help.
Dim qd As QueryDef
Set qd = CurrentDb.QueryDefs("Q_Biw eeklySupre port_Cal")
qd.SQL = ("SELECT * FROM CalDetail WHERE ((CalDetail.ReturnDate) BETWEEN #" & dtStartDate & "# AND #" & dtEndDate & "#) ORDER BY [Type], [TagNo]")
I have something like this, seems like it works, but the subreport picks the result from the last runtime. How do I make the subreport pick the newest result? My subreport name 'rpt_SubReport'. Thanks for help.
Dim qd As QueryDef
Set qd = CurrentDb.QueryDefs("Q_Biw
qd.SQL = ("SELECT * FROM CalDetail WHERE ((CalDetail.ReturnDate) BETWEEN #" & dtStartDate & "# AND #" & dtEndDate & "#) ORDER BY [Type], [TagNo]")
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Do you have the
Link Child Fields and Link Master Fields set on the Sub Report Control?
If so, you should not have to requery the sub report.
mx
Link Child Fields and Link Master Fields set on the Sub Report Control?
If so, you should not have to requery the sub report.
mx
ASKER
OK, I made it work. I moved the code to the Report_Open, instead of Detail_Format.
Thanks for helping
Thanks for helping
ASKER