|
-
Sep 6th, 2006, 03:27 AM
#1
Thread Starter
New Member
List all the reports in a VB6 Project
Hi
Does anyone know how to itterate the reports collection in a VB6 project?
I am trying to present a list to the user, of reports that are available in the application but there doen't seem to be the opportunity to itterate the reports collection as you would any other object.
For instance, If the following code would work, there would be no problem.
VB Code:
Dim rpt as DataReport 'This is OK
For Each rpt in <ThisProject>.DataReports 'This doesnt exist
[INDENT]lstReports.AddItem rpt.Name[/INDENT]
Next rpt
If this worked the user could then select the report name from the list, choose to preview it or not and specify criteria like date ranges etc
Is it possible to achieve what I'm trying to?
Many thanks
-
Sep 6th, 2006, 10:20 AM
#2
Lively Member
Re: List all the reports in a VB6 Project
 Originally Posted by soulbriski
Hi
Does anyone know how to itterate the reports collection in a VB6 project?
I am trying to present a list to the user, of reports that are available in the application but there doen't seem to be the opportunity to itterate the reports collection as you would any other object.
For instance, If the following code would work, there would be no problem.
VB Code:
Dim rpt as DataReport 'This is OK
For Each rpt in <ThisProject>.DataReports 'This doesnt exist
[INDENT]lstReports.AddItem rpt.Name[/INDENT]
Next rpt
If this worked the user could then select the report name from the list, choose to preview it or not and specify criteria like date ranges etc
Is it possible to achieve what I'm trying to?
Many thanks
OK without checking this and without my reference books handy, this is how I remember doing it.
VB Code:
dim x as integer
for x = 0 to Reports.Count
lstReports.AddItem Reports.Item(x).Name
next x
Energy can be neither created not destroyed. It can only be wasted.
Red Green
-
Sep 6th, 2006, 01:51 PM
#3
Thread Starter
New Member
Re: List all the reports in a VB6 Project
Thanks for responding
Reports.Count cannot be referenced. VB thinks 'Reports' is an undeclared variable.
Also
DataReport.Count doesn't work, same reason!
I can't think of a way of doing this but it comes up in many of my apps so i really would like to master it
-
Sep 6th, 2006, 02:34 PM
#4
Lively Member
Re: List all the reports in a VB6 Project
 Originally Posted by soulbriski
Thanks for responding
Reports.Count cannot be referenced. VB thinks 'Reports' is an undeclared variable.
Also
DataReport.Count doesn't work, same reason!
I can't think of a way of doing this but it comes up in many of my apps so i really would like to master it
My apologies that was for Access 2002. It seems that there is no collection for datareports in VB6. You will probably have to think of another way to track reports. The most likely way I would think would be a table and you load the list from the table.
Good Luck anyways Sorry I wasn't any help.
Energy can be neither created not destroyed. It can only be wasted.
Red Green
-
Sep 7th, 2006, 01:52 AM
#5
Thread Starter
New Member
Re: List all the reports in a VB6 Project
Thanks anyway KG
I will carry on doing it the same way as i always do but there must be a better way.
I am leaving this thread open in case anyone comes across it and can help
By the way, the way i do it at present is as you mention with a table containing the report name and a friendly name. the user sees the friendly name but then the corresponding ReportName is run when they select the friendly name from the list or other GUI. The problem with this method is that the table may not be consistent with the reports in the project if for instance i have built a new report and not added it to the table.
Itterating the Reports collection is the only way to do it properly but I'm dammed if i can find out how to
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|