Results 1 to 2 of 2
  1. #1
    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"
    end if

    where the sub reports are named subReportVacationDays,subReportSickDays & subReportPersonalDays

  2. #2
    Join Date
    Dec 2002
    Préverenges, Switzerland
    one way:
    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. ADO equivalent might exist.

    currently using SS 2008R2

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts