I have a report with ´Enter Parameter Values¡ asking the name, date start and
date end.
All data is pulling from query called ´name date¡.
I also have a graph inserted into this report pulling from the same query.
Currently it the ´Enter Parameter Values¡ asking the name, date start and
date end. Pops up three times.
Example:
1st
Name
Date start
Date end
2nd
Name
Date start
Date end
3rd
Name
Date start
Date end
Is there a way to only have the report and graph ask this ones with the same
results?
You'll need to use a form to do this.
First, create a query that will display the fields you wish to show in
the report (and in the graph)).
Second, create a report, using the query as it's record source, that
shows the data you wish to display for ALL records.
Let's assume it is a CustomerID number you need as criteria, as well
as a starting and ending date range.
Next, make a new unbound form.
Add a combo box that will show the CustomerID field as well as the
Customer Name field (you can use the Combo Box wizard to do so).
Set the Combo box's Column Count property to 2.
Hide the CustomerID field by setting the Combo box's ColumnWidth
property to 0";1"
Make sure the Combo Box Bound Column is the
CustomerID field.
Name this Combo Box "cboFindName".
Add 2 unbound text controls to the form.
Set their Format property to any valid date format.
Name one "StartDate".
Name the other "EndDate".
Add a command button to the form.
Code the button's Click event:
Me.Visible = False
Name this form "ParamForm"
Go back to the query. As criteria, on the Query's CustomerID field
criteria line write:
forms!ParamForm!cboFindName
As Criteria on the DateField, write:
Between forms!ParamForm!StartDate and forms!ParamForm!EndDate
Code the Report's Open Event:
DoCmd.OpenForm "ParamForm" , , , , , acDialog
Code the Report's Close event:
DoCmd.Close acForm, "ParamForm"
Run the Report.
The report will open the form.
Find the CustomerName in the combo box.
Enter the starting and ending dates.
Click the command button.
The Report will display just those records selected.
When the Report closes it will close the form.
I hope you do not have a field in your table/query named "Name".
Name is a reserved Access/VBA/Jet word and should not be used as a
field name.
For additional reserved words, see the Microsoft KnowledgeBase article
for your version of Access:
For a more complete list of reserved words, see:
http://www.allenbrowne.com/AppIssueBadWord.html