Subreport Multiple Requests?

J

Julius_Council

I have a report with a couple subreports included. When I run the report I am
prompted to enter a date and the report for that date pops on the screen.

However with these subreports I get asked for the same information repeatedly.

For example I have to enter the date 3 times to get the intended report.
 
A

Allen Browne

Create a little unbound form, with a text box where you can enter the date
and a command button to fire off the report.

Change the queries so they all read the date from the form, by using
something like:
[Forms].[Form1].[Text0]
 
M

Marshall Barton

Julius_Council said:
I have a report with a couple subreports included. When I run the report I am
prompted to enter a date and the report for that date pops on the screen.

However with these subreports I get asked for the same information repeatedly.

For example I have to enter the date 3 times to get the intended report.


Instead of using those quick and dirty parameter prompts in
your queries, create an unbound form with text boxes for the
parameters (and a button to open the report). Then the
queries can use parameters like Forms!theform.textbox1
 
C

Cheryl Floyd

I'm having this same problem, and I tried your solution. However, I must be
missing a step. I have programmed the query (that feeds the subreport) as you
instructed. I have created a dialog box, as you instructed, with a button
that opens the report. What do I do next? I created a macro that opens the
dialog box when I open the report. However, now I get not only the dialog
box, but also another box that asks for [Forms]![TheForm]![Textbox]. What am
I doing wrong?

Allen Browne said:
Create a little unbound form, with a text box where you can enter the date
and a command button to fire off the report.

Change the queries so they all read the date from the form, by using
something like:
[Forms].[Form1].[Text0]

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.
Julius_Council said:
I have a report with a couple subreports included. When I run the report I
am
prompted to enter a date and the report for that date pops on the screen.

However with these subreports I get asked for the same information
repeatedly.

For example I have to enter the date 3 times to get the intended report.
 
A

Allen Browne

If TheForm is open (not in design view), and has a text box named Textbox on
it, and the subreport's query has criteria of:
[Forms]![TheForm]![Textbox]
then it should be able to find it.

If it is popping up a parameter box, it indicates Access can't find it.
There could be several reasons, but the most likely is that the names don't
match exactly (e.g. there's a space in the name.)

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Cheryl Floyd said:
I'm having this same problem, and I tried your solution. However, I must
be
missing a step. I have programmed the query (that feeds the subreport) as
you
instructed. I have created a dialog box, as you instructed, with a button
that opens the report. What do I do next? I created a macro that opens the
dialog box when I open the report. However, now I get not only the dialog
box, but also another box that asks for [Forms]![TheForm]![Textbox]. What
am
I doing wrong?

Allen Browne said:
Create a little unbound form, with a text box where you can enter the
date
and a command button to fire off the report.

Change the queries so they all read the date from the form, by using
something like:
[Forms].[Form1].[Text0]
 
C

Cheryl Floyd

I have triple and quadruple-checked the spelling of the all these pieces of
the process. I'm still seeing these little pop-up boxes multiple times before
it will open the report. It's the same whether I use the unbound form for the
query to read from, or put the parameter prompt right in the query itself.

What other ideas do you have?
 
A

Allen Browne

Cheryl, there has to be a problem with the name of the parameter.

To help you track it down, open the Immediate Window (Ctrl+G), and enter:
? CurrentDb.QueryDefs("Query1").Paramters(0).Name
substituting your query name for Query1.
Look at what comes out. It will be the same as the title of the parameter
dialog.

Now insert a question mark and space in front of that. For example, if it
says:
[Forms]![TheForm]![Textbox]
you will have:
? [Forms]![TheForm]![Textbox]
Move the cursor to the end, and press Enter.
Does this give you an error?
Can you see why Access can't find it?

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Cheryl Floyd said:
I have triple and quadruple-checked the spelling of the all these pieces of
the process. I'm still seeing these little pop-up boxes multiple times
before
it will open the report. It's the same whether I use the unbound form for
the
query to read from, or put the parameter prompt right in the query itself.

What other ideas do you have?


Allen Browne said:
If TheForm is open (not in design view), and has a text box named Textbox
on
it, and the subreport's query has criteria of:
[Forms]![TheForm]![Textbox]
then it should be able to find it.

If it is popping up a parameter box, it indicates Access can't find it.
There could be several reasons, but the most likely is that the names
don't
match exactly (e.g. there's a space in the name.)
 
C

Cheryl Floyd

Mr. Browne, I'm embarrassed to tell you that I found the error even before I
read your post below. I had a macro set to close the dialog box, but I had
the macro in the "On Open" function of the report. DUH!

Your previous posts were most helpful, though. The original idea of creating
the form into which the parameter would be typed, instead of using the query
for the parameter, was right on.

Furthermore, you said, "The report is not finding the dialog box." I kept
mulling that over in my head and finally realized why the report wasn't
finding the dialog box. It was because it was closing before the subreport
had a chance to open. DOUBLE DUH!

I really appreciate your dedication to help those of us who get stuck in
Access ruts.

Cheryl Floyd

Allen Browne said:
Cheryl, there has to be a problem with the name of the parameter.

To help you track it down, open the Immediate Window (Ctrl+G), and enter:
? CurrentDb.QueryDefs("Query1").Paramters(0).Name
substituting your query name for Query1.
Look at what comes out. It will be the same as the title of the parameter
dialog.

Now insert a question mark and space in front of that. For example, if it
says:
[Forms]![TheForm]![Textbox]
you will have:
? [Forms]![TheForm]![Textbox]
Move the cursor to the end, and press Enter.
Does this give you an error?
Can you see why Access can't find it?

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Cheryl Floyd said:
I have triple and quadruple-checked the spelling of the all these pieces of
the process. I'm still seeing these little pop-up boxes multiple times
before
it will open the report. It's the same whether I use the unbound form for
the
query to read from, or put the parameter prompt right in the query itself.

What other ideas do you have?


Allen Browne said:
If TheForm is open (not in design view), and has a text box named Textbox
on
it, and the subreport's query has criteria of:
[Forms]![TheForm]![Textbox]
then it should be able to find it.

If it is popping up a parameter box, it indicates Access can't find it.
There could be several reasons, but the most likely is that the names
don't
match exactly (e.g. there's a space in the name.)
 

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