Results 1 to 8 of 8
  1. #1
    Join Date
    Mar 2009
    Location
    Gatineau, Quebec Canada
    Posts
    147
    Provided Answers: 1

    Unanswered: Changing a Control Source in a Report

    Greetings all,
    I have been having a wonderful time changing the controlsource property in forms (after getting advice here), so I thought, hey, lets do the same in a report.

    I wanted to change a controlsource in the detail section of the report (so one report design can be used for ad hoc exams, mid term exams and final exams). The textbox in question, under "properties" does have "controlsource", but when I tried to change this in the report open event, no dice -- there is no "controlsource" (or "recordsource") property available.

    So can you change a controlsource property in a report in the same way you can in a form, and if so, how?

    Regards

    John Smith
    Xingjian College
    Guangxi U
    China

  2. #2
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    You cannot change the controlsource property of a report once rasterization has begun (either for previewing or printing). It can only be done is design view.
    Have a nice day!

  3. #3
    Join Date
    Mar 2009
    Location
    Gatineau, Quebec Canada
    Posts
    147
    Provided Answers: 1

    Another Brainfart

    Well, it turns out that you can change the controlsource property on the report open event. Sigh. This is very nice if you want to do analysis of mark distributions in the report footer. Different data is manipulated by the same formula.

    I was a bit too quick on seeing a problem.

    Regards

    John S
    Guangxi U
    China

  4. #4
    Join Date
    Mar 2009
    Location
    Gatineau, Quebec Canada
    Posts
    147
    Provided Answers: 1

    Brainfrt # 2

    My colleague it seems is both right and wrong about changing the control source. The good news: you can change it. The bad news: summary statistics in reports are based on the underlying database, not on the report itself, so it is useless to change the control source if what you want is to reuse the summary statistics in the report footer. I guess I am off looking for another solution. Sigh.

    But the good news is I understand much more how summary statistics are tabulated in reports.

    We don't get older and wiser, only older...

    Regards

    John S
    Guangxi U
    China

  5. #5
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    Not sure what you mean by 'summary statistics' in the report footer but if you mean you have specific onFormat type coding or summarizing fields, changing the control source should work depending on how you have this setup. Again, it depends on the setup.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  6. #6
    Join Date
    Mar 2009
    Location
    Gatineau, Quebec Canada
    Posts
    147
    Provided Answers: 1

    Report Control Source Coding

    Hi,

    I used the report on open event, and changed the control source for the text box. Works fine, but the summary statistics do not change. I realized that they were based on references to the database (i.e., field names), and not on the report object in the detail section. So, I tried to do a summary on the textbox in the detailed section. No dice (sum([txtBox].[value]) won't work.

    How do I change the control source (which is part of detailed calculations; sums, IIF statement, etc) in the report footer?

    Sign. Nothing in this world is easy!

    Regards

    John S

    PS. and thanks for the advice about form control sources.

  7. #7
    Join Date
    Mar 2009
    Location
    Gatineau, Quebec Canada
    Posts
    147
    Provided Answers: 1

    Report Footer Control Source

    Before I babble further, I will try setting a control source in the report footer on format event, and let you know if it works.

    Ah, the adventure continues (gotta get a life)!

    Regards

    John S


    Quote Originally Posted by pkstormy View Post
    Not sure what you mean by 'summary statistics' in the report footer but if you mean you have specific onFormat type coding or summarizing fields, changing the control source should work depending on how you have this setup. Again, it depends on the setup.

  8. #8
    Join Date
    Mar 2009
    Location
    Gatineau, Quebec Canada
    Posts
    147
    Provided Answers: 1

    Control Sources in Reports

    Well, I babble further -- you can set control sources in the detail section AND in the reporter footer section on the report open event. Unfortunately, all you get in the report footer section is the first value in a series (i.e. you get a single value), so it is useless (unless their is something obvious that I am missing.


    This is all about using a single report design to look at different groups of marks (mid terms, final exams, etc), and to at the same time generate summary statistics (how many failed, how many got between 90 and 1oo percent, etc). Easily done with multiple report designs, but so inelegant (i definitely have to get a life)!

    Regards


    John S

Posting Permissions

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