Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

vb.net and acces report

Status
Not open for further replies.

sbdproj

Programmer
Sep 22, 2003
22
NL
Hi,

I'm having a problem with opening an access report in my program.
I'm using an access database(2003) in which I've already made some reports. In my my program I fill the databases and then after hitting a button I want to view the reports I've already made.

I got the progam to open access but when I want to open and view the reports it goes wrong. Instead of opening the report access gives me the possibility to save the report as an PDF file.
This is the code I'm using:
Dim oAccess As Object
oAccess = CreateObject("Access.Application")
oAccess.OpenCurrentDatabase(filepath:="S:\Schildklier_Portaal.mdb", exclusive:=False)
oAccess.DoCmd.OpenReport(ReportName:="qry_overzicht_schildkliermeting")

What am I doing wrong here? Or is there an easier way to view the reports I've made?

paul
 
I'm checkin' it out now, I've never used it before.
I thought it would be easy to open an access report in vb.net but apparently it doesn't...
 
do this insttead
make a reference to microsoft access 10.0 objects or another version
If you want to print change acviewpreview to acviewnormal

Code:
dim Accessapp as New Access.Application 
Accessapp.OpenCurrentDatabase (FilePathName) 

Accessapp.DoCmd.OpenReport (Reportname, Access.AcView.acViewPreview)
Accessapp.Visible = True

Christiaan Baes
Belgium

If you want to get an answer read this FAQ faq796-2540
There's no such thing as a winnable war - Sting
 
I've added the reference "Microsoft Access 11.0 Object Library" . It stands in my list with other references but I still get these errors:
Type 'Access.Application' is not defined. and
Name 'Access' is not declared.

any ideas?


 
if you type imports what is the list you are getting mine says access as the first member. Perhaps they changed it for acces 11 into msaccess perhaps. Sorry but i don't have access 2003.

Christiaan Baes
Belgium

If you want to get an answer read this FAQ faq796-2540
There's no such thing as a winnable war - Sting
 
if I type imports I get this list:
ADODB
ChristalDecisions
Dao
Microsoft
ReadWriteFile (my app.name)
Std
System
Util

Where should I find access?
 
perhaps under microsoft

Christiaan Baes
Belgium

If you want to get an answer read this FAQ faq796-2540
There's no such thing as a winnable war - Sting
 
I've found it:
Imports Microsoft.Office.Interop.Access

But I still get the same errors.
Type 'Access.Application' is not defined. and
Name 'Access' is not declared.

Am I forgetting something else what could cause these errors?
 
then i think it coul be

Code:
dim Accessapp as New Microsoft.Office.Interop.Access.Application 
Accessapp.OpenCurrentDatabase (FilePathName) 

Accessapp.DoCmd.OpenReport (Reportname, Microsoft.Office.Interop.Access.AcView.acViewPreview)
Accessapp.Visible = True

Christiaan Baes
Belgium

If you want to get an answer read this FAQ faq796-2540
There's no such thing as a winnable war - Sting
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top