|
-
Nov 21st, 2000, 06:09 AM
#1
Thread Starter
Lively Member
Heres my code to generate the list of reports.
I get nothing out and temp = 0 but I have three reports!!
can anyone help?
H.
Code:
Private Sub Form_Load()
' Initialise list of reports
Dim temp As Integer
Dim temploop As Integer
Set ErrReport = CreateObject("Access.Application")
ErrReport.OpenCurrentDatabase "C:\db1.mdb"
temp = ErrReport.Reports.Count
For temploop = 0 To temp - 1
lstReports.List(temploop) = ErrReport.Report(temploop).Name
Next
End Sub
 Just trying to muddle through...
-
Nov 21st, 2000, 06:31 AM
#2
Fanatic Member
Code:
Dim x As New Access.Application
Dim obj As AccessObject, dbs As Object
x.OpenCurrentDatabase "c:\db1.mdb"
Debug.Print x.CurrentProject.AllReports.Count
hth
Crispin
VB6 ENT SP5
VB.NET
W2K ADV SVR SP3
WWW.BLOCKSOFT.CO.UK
[Microsoft Basic: 1976-2001, RIP]
-
Nov 21st, 2000, 06:42 AM
#3
Thread Starter
Lively Member
Sorry but currentproject isn't recognised.
What I'm trying to do is display a list of all available reports so that users can click on them and open them.
If I manually fill the list the program works but what I want to do is get the names of all available records and fill the list using a loop rather than hard code
do you have any ideas?
 Just trying to muddle through...
-
Nov 21st, 2000, 06:53 AM
#4
Fanatic Member
Crispin
VB6 ENT SP5
VB.NET
W2K ADV SVR SP3
WWW.BLOCKSOFT.CO.UK
[Microsoft Basic: 1976-2001, RIP]
-
Nov 21st, 2000, 06:54 AM
#5
Fanatic Member
Hollie,
read my post in the Database thread. Key is to use the Documents in the Containers collection. Reports collection is the OPEN reports only.
Cheers,
P.
Not nearly so tired now...
Haven't been around much so be gentle...
-
Nov 21st, 2000, 06:59 AM
#6
Thread Starter
Lively Member
Thanks for all your help guys!
Hollie
 Just trying to muddle through...
-
Nov 21st, 2000, 07:00 AM
#7
Fanatic Member
Hollie,
This works fine on my machine, Except it lists the reports in reverse order (shouldn't be too difficult to solve)
Using ACCESS 2000, via the 9.0 Object Lib
Code:
Private Sub Command1_Click()
' Initialise list of reports
Dim temp As Integer
Dim temploop As Integer
Dim Y As Object
Set ErrReport = CreateObject("Access.Application")
ErrReport.OpenCurrentDatabase "C:\db1.mdb"
For Each Y In ErrReport.CurrentProject.AllReports
List1.AddItem Y.Name
Next Y
End Sub
Crispin
VB6 ENT SP5
VB.NET
W2K ADV SVR SP3
WWW.BLOCKSOFT.CO.UK
[Microsoft Basic: 1976-2001, RIP]
-
Nov 21st, 2000, 11:31 AM
#8
Originally posted by crispin
Hollie,
...Except it lists the reports in reverse order (shouldn't be too difficult to solve)...
Code:
...
List1.AddItem Y.Name
...
Try this:
Code:
...
List1.AddItem Y.Name , 0
...
-
Nov 21st, 2000, 11:36 AM
#9
Thread Starter
Lively Member
Thanks for all your help guys - I have now got it working!
H.
 Just trying to muddle through...
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
|