Results 1 to 14 of 14
  1. #1
    shades714 is offline Novice
    Windows 8 Access 2007
    Join Date
    Jun 2019
    Posts
    13

    one report to rule them all ( i know, that a horrible way analogy)

    So here is what I have. 1x table with all data. 4x queries dividing the data up by departments. 4x reports (personal, work history, training, finance)


    Here's what Id like to be able to do.....
    I want to create a simple form that I can select from a drop down one of those queries and then be able to select a button that will display the corresponding report but only for the department I selected in the drop down.
    When the report display I would like it to have the department name up in the header but thats not as important as getting everything to work on the same report

    the report design doesnt change....just the data

    I know something along these lines is possible and i do not want to create a separate report for each department.

    im useing 2007-2016 on a WIN 10.

  2. #2
    madpiet is offline Expert
    Windows 10 Office 365
    Join Date
    Feb 2023
    Posts
    564
    Pass a filter in the Report's Open event and pass the parameters from your comboboxes. Use ONE report. Create the report with only the filters you want for every "version" of the report. Except you only have one report. Open it from an unbound form where users can choose the filters they want to apply, and then concatenate all the reports into a string and the you pass those in the Open event of the report.

  3. #3
    shades714 is offline Novice
    Windows 8 Access 2007
    Join Date
    Jun 2019
    Posts
    13
    great......i should clarify something. i understand what you are saying but not the how. can you give me a little more detail and possibly steps to do.

  4. #4
    madpiet is offline Expert
    Windows 10 Office 365
    Join Date
    Feb 2023
    Posts
    564
    Quote Originally Posted by shades714 View Post
    great......i should clarify something. i understand what you are saying but not the how. can you give me a little more detail and possibly steps to do.
    Create a button on a form and have the wizard open a report for you.

    DoCmd.OpenReport method (Access) | Microsoft Learn

  5. #5
    davegri's Avatar
    davegri is online now Excess Access
    Windows 11 Access 2019
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,740
    Have a look at this:

    Shades-davegri-v01accdb.zip

    Click image for larger version. 

Name:	chooseRpt.png 
Views:	41 
Size:	7.6 KB 
ID:	52211

  6. #6
    shades714 is offline Novice
    Windows 8 Access 2007
    Join Date
    Jun 2019
    Posts
    13
    not exactly what im going for. I clarify further....
    i have a form with several buttons and each button when selected brings up the specific report. I am looking to add a drop down to that same form that when you select a department and select one of the buttons it will bring up the report with only that departments info on it. Hope that clarifies it better

  7. #7
    ano is offline Competent Performer
    Windows 11 Office 365
    Join Date
    Nov 2023
    Posts
    204
    you mean : the button start the report already but before the button you like to select a department that is active in those reports.
    then you take the example you have here and the
    Code:
    DoCmd.OpenReport "your_report", acViewPreview, , "SelectType='" & cboChoice & "'"
    assuming you have this code nearly in use
    and in your report : in heading field
    Code:
    ="Report for " & [SelectType]
    seems to me what you are looking for.
    did u test and check the codes?

  8. #8
    davegri's Avatar
    davegri is online now Excess Access
    Windows 11 Access 2019
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,740
    Assume 4 reports, all from same table. Each callable to show one of 4 departments or all departments if dropdown not used.
    Report headings indicate report content.

    Shades-davegri-v02accdb.zip

    Click image for larger version. 

Name:	shades.png 
Views:	35 
Size:	10.3 KB 
ID:	52219
    Last edited by davegri; 09-18-2024 at 01:07 PM. Reason: clarif

  9. #9
    ano is offline Competent Performer
    Windows 11 Office 365
    Join Date
    Nov 2023
    Posts
    204
    i would hide the buttons till choosen which department and then visible so there is input

  10. #10
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,552
    I used to use a combo for my reports, as there were a few I could run.
    Attached Thumbnails Attached Thumbnails OpenReport.jpg  
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  11. #11
    davegri's Avatar
    davegri is online now Excess Access
    Windows 11 Access 2019
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,740
    Quote Originally Posted by ano View Post
    i would hide the buttons till choosen which department and then visible so there is input
    My interpretation of post#1 was that the reports could be run without any dropdown as well.

  12. #12
    ano is offline Competent Performer
    Windows 11 Office 365
    Join Date
    Nov 2023
    Posts
    204
    then you should put the selection left from the buttons

  13. #13
    madpiet is offline Expert
    Windows 10 Office 365
    Join Date
    Feb 2023
    Posts
    564
    "concatenate all the reports"? LOL

    Sorry, what I meant was to "concatenate all the filters"

  14. #14
    madpiet is offline Expert
    Windows 10 Office 365
    Join Date
    Feb 2023
    Posts
    564
    The biggest problem with a layout like this is "What happens when you add another report?" that's why I don't use buttons like that. Access can't use control arrays the way VB can. that's a big reason to use comboboxes and listboxes, because you can filter them. (show/hide items)

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

Similar Threads

  1. Replies: 9
    Last Post: 05-08-2022, 11:08 AM
  2. Replies: 10
    Last Post: 11-23-2015, 05:47 PM
  3. Replies: 2
    Last Post: 10-21-2015, 08:46 PM
  4. Is Access horrible for my database???
    By latestgood in forum Access
    Replies: 4
    Last Post: 07-27-2011, 09:22 AM
  5. Dates and all that horrible stuff
    By clean32 in forum Programming
    Replies: 8
    Last Post: 06-20-2011, 06:34 PM

Tags for this Thread

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