Closing Subform on opening of Report Preview causing problem.

JimJones

Registered User.
Local time
Today, 02:09
Joined
May 6, 2003
Messages
78
Hi.

I have a pop up form with a value I need to pass to a report.
Upon double-clicking int he heading area of the pop-up form, causes the Report to open in Preview mode (that all works).

Then, I thoght I'd go in to the open event, in report design and put a close statement to close the pop up form as soon as the report preview opens. (fine and dandy except . . . )

There's a sum I need to pass to the report and it doesn't show
up where it's supposed to because I've closed the pop up.

The real problem is I can't seem to get the right combination
of "Me!", "[ ]" ! and which one comes first in the string to place
on the subform's close event.

So, in that scenario, how do I pass the total field from the popup form (which is query generated), to the field in my report, before I lose that value by closing my pop up form?

Thanks for all help,
Jim
 
Rather than close the popup, hide it when the report opens then on the close event of the report, close them both.
 
Your explanation confused me a bit, but I think I can at least help you with passing a number to your report without having to keep that subform (or pop-up form) open.

If you're using Access 2002, it's simple. The DoCmd.OpenReport method has an OpenArgs method. Simply pass the value that way and it's done. If you're using an earlier version, you can achieve a similar effect by putting the value you want to pass to the report in some other location that will remain open. I often use the Tag property of the calling form (but you can use the tag property of any control, in fact you can set up a non-visible non-enabled control just for this purpose). Just assign the value you want to pass to the Form's Tag property like this:
Me.Tag=passedvalue
or
Forms!FormName.Tag=passed value
then reference the value from the report by including some code in the open or load event like this:
If Forms!FormName.Tag <> "" Then
   'do this
Else
   'do this code
End If
 
I'd use Fizzio's solution if you don't need to close the pop-up form.
 
Oops. Sorry, this problem is NOT solved.

I don't know why I thought it worked, but apparently I was mistaken.

For the benefit of those new to this thread, the following is what I tried and I thought it solved my problem, but it didn't:

~~~~~~~~~~~~~~~
Though I did what Fizzio suggested, at first it didn't work.

But then I figure out what Fizzio was trying to convey. I did it
like this:

I had to put a minimize statement in my double-code (which kicks off the print preview command from my pop up form).
Then, on the report preview Open event, I put in a statement
to close the pop up form. That little time lag was needed to
let the update state on the report.

~~~~~~~~~~~~~~~~~~~

Sorry for the false info.

But I made it work by taking out the close statement from the Report's Open event.

Thank You for the help,
Jim
 
Last edited:

Users who are viewing this thread

Back
Top Bottom