Connecting Tech Pros Worldwide Forums | Help | Site Map

report on close

windandwaves
Guest
 
Posts: n/a
#1: Nov 13 '05
Hi Gurus

I have a bunch of reports where I have added the following function to the
onclose event:

=FROC()

where FROC() opens a form.

However, i found that if i have a report with more than one page, froc is
executed when I go from page 1 to page 2. Is there a way to stop this from
happening?

TIA

- Nicolaas



windandwaves
Guest
 
Posts: n/a
#2: Nov 13 '05

re: report on close


windandwaves wrote:[color=blue]
> Hi Gurus
>
> I have a bunch of reports where I have added the following function
> to the onclose event:
>
> =FROC()
>
> where FROC() opens a form.
>
> However, i found that if i have a report with more than one page,
> froc is executed when I go from page 1 to page 2. Is there a way to
> stop this from happening?
>
> TIA
>
> - Nicolaas[/color]

as i added =FROC() to all my reports, could it be the case that it is
related to a subform?


fredg
Guest
 
Posts: n/a
#3: Nov 13 '05

re: report on close


On Sun, 5 Jun 2005 12:10:44 +1200, windandwaves wrote:
[color=blue]
> Hi Gurus
>
> I have a bunch of reports where I have added the following function to the
> onclose event:
>
> =FROC()
>
> where FROC() opens a form.
>
> However, i found that if i have a report with more than one page, froc is
> executed when I go from page 1 to page 2. Is there a way to stop this from
> happening?
>
> TIA
>
> - Nicolaas[/color]

If the form is opening as you go from page to page, you have something
else opening the form, not this code.

1) Writing
=FROC()
(as you have posted it) in the close event will cause a compile error.

2) If all you are doing with the function is opening a form, you don't
need a function. A function is used to return a value. No value is
being returned.

You can open it directly in the close event using:
DoCmd.OpenForm "FormName"

3) If for some reason you need to do it outside of the close event, a
sub procedure would be more suitable than a function:

Sub FROC()
DoCmd.OpenForm "FormName"
End Sub

In the Close event you would then call the procedure using:
froc

No = sign and no parenthesis.

The above will only fire when the report is closed.
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
Tom van Stiphout
Guest
 
Posts: n/a
#4: Nov 13 '05

re: report on close


On Sun, 5 Jun 2005 12:10:44 +1200, "windandwaves"
<winandwaves@coldmail.com> wrote:

I can't reproduce that if I write:
Private Sub Report_Close()
MsgBox "Report_Close"
End Sub
in a Northwind sample report. Set a breakpoint at the top of the
function and review the call stack. Something else may be calling your
function.

-Tom.

[color=blue]
>Hi Gurus
>
>I have a bunch of reports where I have added the following function to the
>onclose event:
>
>=FROC()
>
>where FROC() opens a form.
>
>However, i found that if i have a report with more than one page, froc is
>executed when I go from page 1 to page 2. Is there a way to stop this from
>happening?
>
>TIA
>
>- Nicolaas
>[/color]

Closed Thread


Similar Microsoft Access / VBA bytes