473,847 Members | 1,525 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

VB.NET - reading reports from Access MDB

I've got some VB.NET code that *should* get a list of reports from an
Access MDB and populate a list box with them.

It doesn't detect any of the reports at all. oAccess.Reports .Count
comes up as 0. There are four reports in the MDB. They are not hidden.
They don't have special characters in their names. There is no security
on the MDB and no one else is accessing it.

I have code currently to only show reports that start with "rpt_", but
I've taken that out and it doesn't help. Also, the .Count occurs before
that.

It does open the MDB just fine. If I uncomment the line to run a
specific report by name, that report runs fine as well, so I know it
can find the reports. It just can't find the .Reports collection.

Here's the code:

' Start a new instance of Access for Automation
Dim oAccess as Access.Applicat ion
Dim sDBPath as String
Dim nCount as Integer

oAccess = New Access.Applicat ionClass
' Determine the path
sDBPath = gAppEnv.CvsData Path
' open the database
oAccess.OpenCur rentDatabase(sD BPath, False)
' read in all of the available reports
nCount = oAccess.Reports .Count
For Each oRpt In oAccess.Reports
cRptName = oRpt.Name
' if it starts with "rpt_"
If cRptName.Substr ing(0, 4).ToLower = "rpt_" Then
lstReports.Item s.Add(cRptName. Split("rpt_")(1 ))
End If
Next
' just run a report by name
'oAccess.Visibl e = True
'oAccess.DoCmd. OpenReport("rpt _Validation Error Report",
Access.AcView.a cViewPreview)

Nov 21 '05 #1
2 3273
Hi B,

The Reports collection holds only the open reports

try
nCount = oAccess.Contain ers("Reports"). Documents.Count
For Each oRpt In oAccess.Contain ers("Reports"). Documents

Doug

"B.Newman" <b2******@or.bl m.gov> wrote in message
news:11******** *************@f 14g2000cwb.goog legroups.com...
I've got some VB.NET code that *should* get a list of reports from an
Access MDB and populate a list box with them.

It doesn't detect any of the reports at all. oAccess.Reports .Count
comes up as 0. There are four reports in the MDB. They are not hidden.
They don't have special characters in their names. There is no security
on the MDB and no one else is accessing it.

I have code currently to only show reports that start with "rpt_", but
I've taken that out and it doesn't help. Also, the .Count occurs before
that.

It does open the MDB just fine. If I uncomment the line to run a
specific report by name, that report runs fine as well, so I know it
can find the reports. It just can't find the .Reports collection.

Here's the code:

' Start a new instance of Access for Automation
Dim oAccess as Access.Applicat ion
Dim sDBPath as String
Dim nCount as Integer

oAccess = New Access.Applicat ionClass
' Determine the path
sDBPath = gAppEnv.CvsData Path
' open the database
oAccess.OpenCur rentDatabase(sD BPath, False)
' read in all of the available reports
nCount = oAccess.Reports .Count
For Each oRpt In oAccess.Reports
cRptName = oRpt.Name
' if it starts with "rpt_"
If cRptName.Substr ing(0, 4).ToLower = "rpt_" Then
lstReports.Item s.Add(cRptName. Split("rpt_")(1 ))
End If
Next
' just run a report by name
'oAccess.Visibl e = True
'oAccess.DoCmd. OpenReport("rpt _Validation Error Report",
Access.AcView.a cViewPreview)

Nov 21 '05 #2
Thanks, Doug, but my Access object doesn't recognize any property
called Containers. I've read that some drivers should be downloaded
from Microsoft and installed to allow better VB.Net Office automation,
but I can't install anything on my box and my users won't be able to
either. Is that the problem or can I make it work with the existing
Microsoft Access 10.0 Object Library?

Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
6766
by: Magnus | last post by:
allrite folks, got some questions here... 1) LAY-OUT OF REPORTS How is it possible to fundamentaly change the lay-out/form of a report in access? I dont really know it that "difficult", but listen up; Reports, the way I look at them, all present data downwards, in this way; TITLE data
2
5775
by: Andrew | last post by:
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
3
6921
by: Gheaci Maschl | last post by:
Hi all! I would like to have your opinion about my problem and my proposal how to solve it: Ingredients: - BTriev database - Crystal Reports - maybe MS Access - Liinos6 (small ERP software)
2
1865
by: Timppa | last post by:
Hi, I have Access 2000 and now I'm converting .mdb database to .adp and Sql Server 2000. In old .mdb application I have a query which handles msysobjects table (reading forms and reports information). How could I read information about forms and reports in .adp application ? Has .adp any information about forms and reports ? Is it possible to read from a table what forms and reports you have in
5
4049
by: Jerry Hull | last post by:
I'm working with a database developed by an untrained person over several years - and on a network that has recently been upgraded with a new server installed and MS office upgraded from 2K (I think - it might have been XP) to 2003. The database is impressive, both in what it does and the obtuse and inconsistent ways it works. There are several hundred queries, for example, with no indication of where they are used or if they are in fact...
11
6615
by: Grasshopper | last post by:
Hi, I am automating Access reports to PDF using PDF Writer 6.0. I've created a DTS package to run the reports and schedule a job to run this DTS package. If I PC Anywhere into the server on where the job is running, the job runs sucessfully, PDF files got generated, everything is good. If I scheduled the job to run at the time that I am not logged into the server, Access is not able to print to the printer. The error is pretty...
16
48899
by: cyranoVR | last post by:
This is the approach I used to automate printing of Microsoft Access reports to PDF format i.e. unattended and without annoying "Save As..." dialogs, and - more importantly - without having to use a commercial program such as Adobe Acrobat and its associated API. The technique uses Ghostscript and Redirection Port Monitor - two free programs for creating PDF documents provided free by Russell Lang. The actual automation requires VBA...
12
2536
by: Tony Ciconte | last post by:
We are evaluating the prospect of integrating and/or using Crystal Reports with some of our current products. Some of these are still in Access 97 and are running well. Since we cannot include the report wizard in a runtime environment, we are looking at ad hoc report writers like Crystal. Can we include Crystal with our runtimes and/or is there another report writer that we should be looking at? Any and all help is greatly appreciated.
16
6545
by: JoeW | last post by:
I'm utilizing a database that I created within MS Access within a program I've created in VB.NET. I am using the VB front end to navigate the information, but want to be able to print a report, that I've also created within MS Access. I've attempted using the Access.Application instance, but I get errors when it tries to load the database. Just wondering if anyone has any experience with this, and what I should do. Thanks for any...
0
9892
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9735
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10996
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
7889
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7062
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5730
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4541
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4133
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3171
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.