By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,694 Members | 2,121 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,694 IT Pros & Developers. It's quick & easy.

Syntax for Reports! & GroupLevel

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
-----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

P: n/a
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.