Results 1 to 2 of 2
  1. #1
    Robbyp2001 is offline Novice
    Windows Vista Access 2010 32bit
    Join Date
    Oct 2011
    Posts
    25

    Single Report, Many Search Criteria activated by a button for each.

    Hello folks



    I have a database that at the moment contains 11 reports. In design, each report is identical, just the underlying queries are different. Each report is opened from a common form and a button for each.

    Although the reports all work well, it seems to me that it is unnecessary to replicate the report format 11 times and that one report could be generated if the underlying data could change depending on what buttn was pressed and what criteria was applied. This, I’m sure, would require some programming, which is where I am stuck.

    Here’s an example of four of the queries reports that I use currently:

    ReportsMidTerm (report) ReportsMidTermqry
    This would return all of the mid term records for Yeargroups 7. 8, 9 and 10.

    ReportsMidTerm (report) ReportsMidTermByFormClassqry
    This would return all of the mid term records for a particular form class selected from a drop down list.

    ReportsMidTerm (report) ReportsMidTermByStudentqry
    This would return all of the mid term records for a particular student selected from a drop down list

    ReportsMidTerm (report) ReportsMidTermFormTutorqry
    This would return all of the mid term records belonging to a form tutor selected from drop down list.

    So, kind folks, is it possible to construct some code that will contain each of the query search criterias that will be linked to individual buttons on a form? Each search criteria will populate the same report ‘ReportsMidTerm’.

    Since I know that each of the queries that I have now works correctly, can the SQL Code behind each be used when programming?

    I think, if I could see an example of two or three separate queries using the same report, I could build this up to contain all 11….I think.

    Is it possible?

    Rob

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    You could set the record source of the report in its open event, using the form to determine which query to use. That would require the 11 queries. You could also use the SQL of those queries in the same process, saving the 11 queries. I'd probably dynamically build a wherecondition and use this:

    http://www.baldyweb.com/wherecondition.htm

    which would be the most flexible, allowing any combination of criteria.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Create Report from Search Criteria
    By cbrsix in forum Reports
    Replies: 9
    Last Post: 10-03-2012, 04:19 PM
  2. Opening a report with search criteria through a combo box
    By very_much_a_beginner in forum Reports
    Replies: 1
    Last Post: 07-16-2012, 01:30 PM
  3. Exporting single query and single report.
    By rfhall50 in forum Programming
    Replies: 2
    Last Post: 02-18-2011, 12:08 PM
  4. Search Button with Multiple Criteria
    By injanib in forum Forms
    Replies: 2
    Last Post: 01-12-2011, 02:21 AM
  5. Replies: 3
    Last Post: 01-14-2010, 08:32 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums