Solved

Using a form to set criteria for a report

Posted on 2011-09-29
10
246 Views
Last Modified: 2012-06-27
As mentioned in the related question, i would like to understand how to complete the same task using a form to chose the criteria
0
Comment
Question by:SMP319
  • 5
  • 3
  • 2
10 Comments
 
LVL 19

Expert Comment

by:Eric Sherman
ID: 36817683
1.) Use a Select Query for the Record Source of your report.
2.) Open your form.
3.) Pass the parameter from your form to the report as shown below ....

On the Criteria line of the field in your query (say Trx_Date) enter

Between Forms!MyForm!TxtStartDate And Forms!MyForm!TxtEndDate


ET
0
 
LVL 19

Expert Comment

by:Eric Sherman
ID: 36817700
Also, you can open your Form in Dialog mode, have the user select the parameters, then minimize the form, print the report and close the Form with the Report's OnClose Event.

ET
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 36817785
This question has been addressed hundreds of times here.

There are quite a few different approaches to this, depending on your exact needs and skill level.

See here as a start:
http://www.google.com/search?q=site%3Awww.experts-exchange.com+microsoft+Access+filter+report++from+by+a+form
0
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 
LVL 1

Author Comment

by:SMP319
ID: 36892169
Thanks for the reponses. I ended up updating the code from my previous question to look at the value from the combo boxes in the form.
[Division]=[Forms]![Organization Selection]![Combo9] And [Organization]=[Forms]![Organization Selection]![Combo13]

my only issue with this is that once the report opens, i need to close the report and then rerun the form before the values will update in the report. Is there a way to have multiple reports open based on different criteria in the form. or at the least have the report update as soon as the form is updated.

Here is a copy of the database
Account-Project-Management.accdb
0
 
LVL 74

Accepted Solution

by:
Jeffrey Coachman earned 500 total points
ID: 36893958
First, ...Is your original issue here "Filtering the report from a form", now resolved?
Yes or No?

"Is there a way to have multiple reports open based on different criteria in the form. "
Yes but it involves "Instantiating" the form.
This is a whole other topic.

A simple alternative would be to simply close the Report when the form gets the focus.
Then make your new selections, then re-open the report with the button.
Put code like this on the "Activate" event of the form:
    DoCmd.Close acReport, "Research Project Margin"

JeffCoachman

0
 
LVL 1

Author Comment

by:SMP319
ID: 36903323
I resolved my original question by altering the code from my Related question. So yes. Can i give myself the points :). But this created another question which you had resolved.  I will award you the points. Thanks for the work around
0
 
LVL 1

Author Closing Comment

by:SMP319
ID: 36903328
Thanks again
0
 
LVL 1

Author Comment

by:SMP319
ID: 36903482
on my initial test the report closed. however I noticed afterwards that the form is not clearing out the previuous request so when i change my selection i get no results. I have to close the database and reopen. is there code to clear the selection in the form
0
 
LVL 1

Author Comment

by:SMP319
ID: 36904049
Disregard the last post. other issue caused my error. Selected solution works
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 36904729
ok
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

790 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question