Set report format, different SQL query underlying the data

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • James Grant
    New Member
    • May 2011
    • 13

    Set report format, different SQL query underlying the data

    Hi Everyone,

    I've read the Insight article regarding this topic (Courtesy of MMcCarthy); however I suspect there might be an easier way than the mentioned extensive VBA coding.

    My situation has spanned several posts now (first post), and I am still as of yet to post my promised summary code / database structure (sorry! Undergoing a revamp currently), and I now find myself in the situation of writing multiple, repetitive reports for management.

    Because it is preferable for most of the reports to include data only pertaining to certain types of staff (e.g. assistants, administration officers, technicians) depending on which line manager is running the report I've been experimenting with generating a report via an Access 2003 wizard based on a query, creating a visually pleasing and user-friendly format (the wizard is horrible at this), then changing the WHERE statement of the underlying query to filter the results by staff type.

    Whilst this works fantastic for myself, obviously the less tech-savvy users cannot implement this everytime they want a specific report and so I'm looking into being able to create multiple types of Option Buttons (those regarding Staff Type, Currently Active, Filling In A Job, etc) which management can select to filter the type of staff they're interested in, then generate the report using the format I've already defined.

    From MMcCarthy's post I know the <Report object>.RecordS ource property exists. Is it possible to simply modify a "strSQL" variable to append a WHERE statement based on the chosen Option Buttons? This would be perfect, and easier, than the solutions already noted in their article but the Insight went to lengths to be thorough and this was not a mentioned solution.

    Wondering if anyone has an opinion or can help.

    Many thanks!

    James
  • NeoPa
    Recognized Expert Moderator MVP
    • Oct 2006
    • 32633

    #2
    James, it sounds very much like you just need to use the WhereCondition parameter when opening your report. It's some simple SQL filtering (Akin to the WHERE clause of a SQL query but without the word WHERE). No requirement to fiddle around with the underlying RecordSource property at all.

    Comment

    • James Grant
      New Member
      • May 2011
      • 13

      #3
      Again NeoPa your breadth of experience shines through. The WhereCOndition parameter should do the job well. I will start tinkering and experimenting.

      Many thanks for pointing me in the right direction!

      Comment

      • NeoPa
        Recognized Expert Moderator MVP
        • Oct 2006
        • 32633

        #4
        Thank you James :-) It was a pleasure to help.

        Comment

        Working...