469,922 Members | 2,037 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,922 developers. It's quick & easy.

Syntax for Reports! & GroupLevel

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
Nov 12 '05 #1
2 5440
-----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:
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

Nov 12 '05 #2
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:9e*******************@newsread2.news.pas.eart hlink.net...
-----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:
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


Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by Jan van Veldhuizen | last post: by
4 posts views Thread by Ryan Gaffuri | last post: by
7 posts views Thread by Ray Dillinger | last post: by
4 posts views Thread by Call Me Tom | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.