Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2003
    Posts
    233

    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
    Location
    Préverenges, Switzerland
    Posts
    3,740
    one way:
    run the reports (sub-reports) off queries
    modify the query before running the report

    DAO-how:

    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
    qdef.Close


    is DAO code so needs reference to DAO library.
    ...an ADO equivalent might exist.

    izy
    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
  •