Thread: set record source for sub report
11-26-07, 08:37 #1Registered User
- Join Date
- Oct 2003
Unanswered: set record source for sub report
i need to dynamicly filter my report, the report is just a container for 3 sub reports, i would like to add a where cluase to each sub report, but dont know how to reference the sub reports, so say:
if salesPerson="Joe" then
subReportVacationDays.RecordSource = subReportVacationDays.RecordSource & " salesperson =Joe"
subReportSickDays.RecordSource = subReportSickDays.RecordSource & " salesperson =Joe"
subReportPersonalDays.RecordSource = subReportPersonalDays.RecordSource & " salesperson =Joe"
where the sub reports are named subReportVacationDays,subReportSickDays & subReportPersonalDays
11-26-07, 13:18 #2Cavalier King Charles
- Join Date
- Dec 2002
- Préverenges, Switzerland
run the reports (sub-reports) off queries
modify the query before running the report
Dim strSQL As String
Dim qdef As DAO.QueryDef
Set qdef = CurrentDb.QueryDefs("qryBasisOfSomeReportSomewhere ")
strSQL = "SELECT a, b, c FROM d WHERE salesperson = '" & me!cboRep & "'"
qdef.SQL = strSQL
is DAO code so needs reference to DAO library.
...an ADO equivalent might exist.
izycurrently using SS 2008R2