Connecting Tech Pros Worldwide Help | Site Map

Syntax for Reports! & GroupLevel

Andrew
Guest
 
Posts: n/a
#1: Nov 12 '05
Hi there:

I can successfully control a report's GroupLevel ControlSource property by
using:

..Reports!rptEESTMT_A.GroupLevel(i).ControlSource = "CorpName"

where rptEESTMT_A is the actual name of the Access Report.

However, I have about 75 reports to process. Each report has its own unique
name. I don't want to create 75 different statements to process each of
the reports. For example:

..Reports!rptEESTMT_A.GroupLevel(i).ControlSource = "CorpName"
..Reports!rptEESTMT_B.GroupLevel(i).ControlSource = "CorpName"
..Reports!rptEESTMT_C.GroupLevel(i).ControlSource = "CorpName"
..Reports!rptEESTMT_D.GroupLevel(i).ControlSource = "CorpName"
and so on. This is long and tedious.

I created a function that would process each of the reports. I used a
string field called "sReportName" that stores the name of the Access Report
and used it in the statement:

..Reports!sReportName.GroupLevel(i).ControlSource = "CorpName"

However, VB comes back with an error message saying that: "The report name
'sReportName' you entered is misspelled or refers to a report that isn't
open or doesn't exist.". This means VB does not recognize the string
variable "sReportName" actually stores the name of the Access Report.

Can someone please give me suggestions on how to write a function that could
process the reports instead of writing out separate statement for each
Access Report.

Thanks in Advance

Andrew


MGFoster
Guest
 
Posts: n/a
#2: Nov 12 '05

re: Syntax for Reports! & GroupLevel


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Try:

..Reports(sReportName).GroupLevel(i).ControlSource = "CorpName"

Reports is a collection. See the Access help articles on collections
to understand why the above works.

MGFoster:::mgf
Oakland, CA (USA)
-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBP8egDoechKqOuFEgEQLddwCfWfRgiRfM4kG7sWSHNIU7rM/ZIngAn0uN
GuFe4b4OLvglLiJ6n1AvdMOX
=/niS
-----END PGP SIGNATURE-----


Andrew wrote:
[color=blue]
> Hi there:
>
> I can successfully control a report's GroupLevel ControlSource property by
> using:
>
> .Reports!rptEESTMT_A.GroupLevel(i).ControlSource = "CorpName"
>
> where rptEESTMT_A is the actual name of the Access Report.
>
> However, I have about 75 reports to process. Each report has its own unique
> name. I don't want to create 75 different statements to process each of
> the reports. For example:
>
> .Reports!rptEESTMT_A.GroupLevel(i).ControlSource = "CorpName"
> .Reports!rptEESTMT_B.GroupLevel(i).ControlSource = "CorpName"
> .Reports!rptEESTMT_C.GroupLevel(i).ControlSource = "CorpName"
> .Reports!rptEESTMT_D.GroupLevel(i).ControlSource = "CorpName"
> and so on. This is long and tedious.
>
> I created a function that would process each of the reports. I used a
> string field called "sReportName" that stores the name of the Access Report
> and used it in the statement:
>
> .Reports!sReportName.GroupLevel(i).ControlSource = "CorpName"
>
> However, VB comes back with an error message saying that: "The report name
> 'sReportName' you entered is misspelled or refers to a report that isn't
> open or doesn't exist.". This means VB does not recognize the string
> variable "sReportName" actually stores the name of the Access Report.
>
> Can someone please give me suggestions on how to write a function that could
> process the reports instead of writing out separate statement for each
> Access Report.
>
> Thanks in Advance
>
> Andrew
>
>[/color]


Andrew
Guest
 
Posts: n/a
#3: Nov 12 '05

re: Syntax for Reports! & GroupLevel


Thank you for your help. It is working now. I can eliminate a lot of
repetitive codes. : )

"MGFoster" <me@privacy.com> wrote in message
news:9eNxb.20527$sb4.18141@newsread2.news.pas.eart hlink.net...[color=blue]
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Try:
>
> .Reports(sReportName).GroupLevel(i).ControlSource = "CorpName"
>
> Reports is a collection. See the Access help articles on collections
> to understand why the above works.
>
> MGFoster:::mgf
> Oakland, CA (USA)
> -----BEGIN PGP SIGNATURE-----
> Version: PGP for Personal Privacy 5.0
> Charset: noconv
>
> iQA/AwUBP8egDoechKqOuFEgEQLddwCfWfRgiRfM4kG7sWSHNIU7rM/ZIngAn0uN
> GuFe4b4OLvglLiJ6n1AvdMOX
> =/niS
> -----END PGP SIGNATURE-----
>
>
> Andrew wrote:
>[color=green]
> > Hi there:
> >
> > I can successfully control a report's GroupLevel ControlSource property[/color][/color]
by[color=blue][color=green]
> > using:
> >
> > .Reports!rptEESTMT_A.GroupLevel(i).ControlSource = "CorpName"
> >
> > where rptEESTMT_A is the actual name of the Access Report.
> >
> > However, I have about 75 reports to process. Each report has its own[/color][/color]
unique[color=blue][color=green]
> > name. I don't want to create 75 different statements to process each[/color][/color]
of[color=blue][color=green]
> > the reports. For example:
> >
> > .Reports!rptEESTMT_A.GroupLevel(i).ControlSource = "CorpName"
> > .Reports!rptEESTMT_B.GroupLevel(i).ControlSource = "CorpName"
> > .Reports!rptEESTMT_C.GroupLevel(i).ControlSource = "CorpName"
> > .Reports!rptEESTMT_D.GroupLevel(i).ControlSource = "CorpName"
> > and so on. This is long and tedious.
> >
> > I created a function that would process each of the reports. I used a
> > string field called "sReportName" that stores the name of the Access[/color][/color]
Report[color=blue][color=green]
> > and used it in the statement:
> >
> > .Reports!sReportName.GroupLevel(i).ControlSource = "CorpName"
> >
> > However, VB comes back with an error message saying that: "The report[/color][/color]
name[color=blue][color=green]
> > 'sReportName' you entered is misspelled or refers to a report that isn't
> > open or doesn't exist.". This means VB does not recognize the string
> > variable "sReportName" actually stores the name of the Access Report.
> >
> > Can someone please give me suggestions on how to write a function that[/color][/color]
could[color=blue][color=green]
> > process the reports instead of writing out separate statement for each
> > Access Report.
> >
> > Thanks in Advance
> >
> > Andrew
> >
> >[/color]
>
>[/color]


Closed Thread


Similar Microsoft Access / VBA bytes