Macro to generate report

  • Thread starter Thread starter KayleeP
  • Start date Start date
K

KayleeP

Is there a way to run a macro that will automatically create and open a report?
(Without having to click "Create", "Report Wizard", etc.)
 
Kaylee,

I don't believe this is possible.

It is very unusual requirement to create a new report in real-time
production usage. Normally reports would be pre-designed, and then in the
runtime scenario you will be viewing or printing them.

Can you explain any more about what you are really trying to accomplish?

--
Steve Schapel, Microsoft Access MVP


KayleeP said:
Is there a way to run a macro that will automatically create and open a
report?
(Without having to click "Create", "Report Wizard", etc.)



__________ Information from ESET Smart Security, version of virus signature database 4247 (20090715) __________

The message was checked by ESET Smart Security.

http://www.eset.com
 
Thank you for replying.
What i am trying to do is make it as easy as possible for the user, who
knows nothing about access, to generate a report after entering data on a
form.
This is for a landfill database in which the manager will enter the number
of loads coming in to 5 different landfills each day. So, a designed a query
(which displays as a subform for the user) to ask for input: both landfill
location and date parameters. At the end of each month, the manager wants to
be able to generate a month end report of the number of loads for the
landfill specified. However, he doesn't have time, nor the know-how, to
generate a report manually/through the wizard. I was just hoping there was a
way to just click a button which will run the query and automatically
generate the report.

I've already made two steps: (1) one form has a button that runs the query,
(2) which opens as a subform in another form
Then, on the (2) form I put a button to open the report (which is
pre-designed) with the values of the subform displayed in it.

I went to Access 2007 Online Help and I watched the video from Brainstorm
called "Building a Macro". It demonstrated to me something similar as to what
i need. The only difference is that, instead of a combo box, I need the
subform to equal the report. Right now, all the links are working, but the
values of the subform are not appearing in the report.

I hope this all makes sense. I'm not too sure how it all works behind the
scenes. I'm not fluent in SQL. However, I do have an Intermediate level in
Access 2007.
Thank you so much for all your help. I really appreciate it.
:)
All the best,

Kaylee Pare
 
Kaylee,

It looks to me like you have misunderstood something about the concept of
Access reports. And in fact making things harder than they need to be.

There should be no need for the user, or the manager, or anyone, to generate
a report at runtime. Nor is it necessary to "run a query".

Here's the basic idea...
Make a query that provides the data you need for the manager to see.
Use the Criteria of the query to allow the data to be selected according to
a particular date range and/or particular landfill.
Provide unbound textboxes and/or comboboxes on a form, where the user can
enter/select dates or other criteria values, as required.
In the Criteria of the query, instead of hard-coding specific values,
reference the controls on the form, using syntax such as:
[Forms]![NameOfForm]![NameOfControl]
.... or:
Between [Forms]![NameOfForm]![StartDate] And
[Forms]![NameOfForm]![EndDate]
Make a report that shows the data as required by the manager, and make this
query as the Record Source of the report.
Then, when the time comes, all you need is to enter the criteria required on
the form, and click a button with an OpenReport action in a macro, to get
the report with the current data.

Hope that helps give the overall picture. Please get back to us if you need
help with the specifics.
 
Back
Top