| 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] |