Run time error 2451

A

Alain

Hi to all,

Can anyone explain to me why I get this error 2451 when I try to open a
report. I need to change the caption of a label based on a loaded form,
here is the code I use

If IsLoaded("NewFrenchLeaseSummaryActive") Then
Reports!rptFrenchLeaseSummaryPage1.Label0.Caption = "Sommaire de site
(Actif)"
Reports!rptFrenchLeaseSummaryPage2.Label0.Caption = "Sommaire de site
(Actif)"
Reports!rptFrenchLeaseSummaryPage4.Label0.Caption = "Sommaire de site
(Actif)"
Reports!rptFrenchLeaseSummaryPage5.Label0.Caption = "Sommaire de site
(Actif)"
Reports!rptFrenchLeaseSummaryPage6.Label0.Caption = "Sommaire de site
(Actif)"
Reports!rptFrenchLeaseSummaryPage7.Label0.Caption = "Sommaire de site
(Actif)"
End if

this is only part of it since I use 8 different forms that have different
titles.
I have tried on the report_load event of the report, the report_page event
of the report but stille getting the same error

Any help will be needed since it won't make sense for me to build 8
different report just because it is only the title label of the report that
changes

TIA

Alain
 
D

Duane Hookom

Do you have 6 different reports open that you want to set the caption of a
label on each?

I can't imagine placing code in a report that references controls on other
reports that might or might not be open.

I would create global string variables for the captions with public
functions/subs to set or get the values. You could then replace your labels
with text boxes. The control sources of your text boxes would be the
functions to get the value:
=GetRptLabel1()
 
A

Alain

Thanks Duane

I have tought of that possiblilty on my way home last night and came to
almost the same solution. I just wrote a small function that is being called
to change the caption of the label on each report that is being opened and
it is working perfectly

Thanks for your help

Alain
 

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