Report, Paremeter, Form issue

G

Guest

I've created a report with several sub-reports, all queries drawing data from
a base "raw data query" with a beginning and ending date parameter. To avoid
having to re-enter the dates multiple times each time i run my report I've
created a form.

At this point when i open the form itself and enter the beginning and ending
dates, it runs the query correctly. However, when i try to run the query (or
report based off the query) i only get a general parameter box stating Enter
Parameter Value "forms!FORMNAME!StartDate" and another for the end date.
Everything in my query criteria is typed correctly but something must be
wrong... Any suggestions?


Thank you in advance for your help!
 
F

fredg

I've created a report with several sub-reports, all queries drawing data from
a base "raw data query" with a beginning and ending date parameter. To avoid
having to re-enter the dates multiple times each time i run my report I've
created a form.

At this point when i open the form itself and enter the beginning and ending
dates, it runs the query correctly. However, when i try to run the query (or
report based off the query) i only get a general parameter box stating Enter
Parameter Value "forms!FORMNAME!StartDate" and another for the end date.
Everything in my query criteria is typed correctly but something must be
wrong... Any suggestions?

Thank you in advance for your help!

Thre is a difference in the method between running a query to view the
query and running the query as record source for a report.

Here is the general method.
Code the Open event of the Main Report:

DoCmd.OpenForm "YourFormName", , , , , acDoalog.

Code the Report's Close event:
DoCmd.Close acForm, "YourFormName"


Add a command button to your form (or change the code on the existing
form command button).
Code it's Click event:

Me.Visible = False

In each query that is used in this report and it's sub-reports, as
criteria on the date field, use:

Between forms!YourFormName!BeginDateControl and
forms!YourFormName!EndDateControl

** change YourFormName and BeginDateControl and EndDateControl to
whatever the actual form and control names are.

When you wish to run the report, open the Report (not the query or the
form).
When the report opens, it will open the form.
Enter your date parameters.
Click on the Form's Command button.
The form will hide and the report will display.
When you close the report it will close the form.
 
G

Guest

Hi fredg,

I've done everything just as you suggested and now when i run the report the
form opens and i'm able to enter my dates (yeah!!) and select the "OK"
command button. At this point the form becomes invisible and the query runs
and opens showing me the data i've selected in query format, not in the
report. Do you know what i could have done incorrectly that is keeping the
report from showing?

Thanks again for this advice!
 
G

Guest

Hi Fredg,

Nevermind, I went back to review again and i had an extra command in my "OK"
command button on my form. I removed this command and the report (with
sub-reports) are running beautifully.

Thanks so much for your help! This has been weighing on my mind for at
least a month now. I knew it had to be possible but couldn't get it just
right.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top