Results 1 to 5 of 5
  1. #1
    Join Date
    Jul 2015
    Posts
    2

    Question Answered: Display results of a selction criteria in a Report

    Hello, I am new to access so please excuse my lack knowledge and terminology. I am looking to Open a Report, display A selection criteria form and then have the report display the results. I have created the selection form based on a query and the report itself. I know how to write the events to open the form, select the criteria and have the results reported on a report. However I want to open the report (not displayed at this point) then have it display the criteria form for selection and then display results from the selection form on the report. Any help would be greatly appreciated

  2. Best Answer
    Posted by pbaldy

    "I personally go the other way. I open a form, allow the user to enter criteria, then a button on the form opens the report. You can do it your way, but it's trickier. In the open event of the report, open the form using acDialog so code stops while the form is displayed. On the form, just hide it so it's available to the report, then you can close it in the close event of the report."


  3. #2
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    I personally go the other way. I open a form, allow the user to enter criteria, then a button on the form opens the report. You can do it your way, but it's trickier. In the open event of the report, open the form using acDialog so code stops while the form is displayed. On the form, just hide it so it's available to the report, then you can close it in the close event of the report.
    Paul

  4. #3
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    Id agree with the PBaldy's approach, especially if the parameters have to be used in a set of reports.
    I tend to use a (top level) form to call the reports, on that form are the current defaults
    if a user wants to change those defaults they do so through another form
    any form or report pulls the values it requires from the top level form
    to 'pull' a value into, say a report
    INSIDE the report
    Code:
    myvariable = mytoplevelform.mycontrol
    to push a value from one form to another
    Code:
    forms!mydestinationform = mylocalvariable

    the advantage of this approach is that
    the top level form starts off with known sane values (those values might be standard defaults or they could be the current accounting period, whatever, but dont' allow users to change anythign directly on that top level form. that way round the same form coudl be used by say low grade/level staff for standard peridoic reports, or allow users to set parameters as required in the other form
    the any form or report called from the top level form will pick up the same values, so there is no code duplication on data input, no risk of a users mistyping something. so a user could setup theiur query / report prarameters and run a set of reports that reflect those choices. (it coudl be a user can see only their departments data, or can only see the current period, whereas other users may be able to see all divisions, all preriods and so on.
    you build the validation code into the form that allows users to enter data, and passes those values back tot he top level form
    create your sub forms / sub reports without requesting parameters so the report will be general purpsoe (will display all data the parameters it loads int he op open event as required
    I'd rather be riding on the Tiger 800 or the Norton

  5. #4
    Join Date
    Jul 2015
    Posts
    2
    I agree with both answers:, the only reason I went in the direction I did is because I created a Reports pull down menu within the module that displays reports for printing to provide ease of report selection. I did not use command buttons for printing a report ( not sure if it makes sense.) However, I was able to have the report open the form, my issue is event click() coding, what would I use to continue from the form back to the report for result display since I cannot use OpenReport function (because report is essentially open, only stop code for form selection form). Again, being new to Access , I may have made it harder than I should Have.
    Last edited by NavySeal82; 07-22-15 at 16:19.

  6. #5
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    Like I said, if you open the form with acDialog, the report will pause its opening process and wait for the form to either be closed or hidden. On the form, have the user click a button that hides the form. That leaves the form available for the report's query or whatever. Close the form in the report's close event.
    Paul

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
  •