Displaying Access Reports from a VB 6 application 
Author Message
 Displaying Access Reports from a VB 6 application

Hey everyone. I have been working on a program the last few weeks that
handles day to day business functions here at work. I am trying to display
an existing access report from a simple form with a button. Below is the
code I used, which was taken verbatim from another post, however, it does
not work for me. I get an error telling me that "user defined type not
defined." It is not recognizing Access in my code. Am I missing something
here? Did I skip a crutial step somewhere? I have never done this before.

Private Sub Command1_Click()
Dim Acc As access.Application              '*error occurs here
Set Acc = New access.Application
Acc.opencurrentdatabase "c:\windows\desktop\new\Lazer Database.mdb"
Acc.docmd.openreport "Employee Job Pay", acpreview
Acc.Visible = True
Set Acc = New access.Application
End Sub

Thanks

Mike



Wed, 22 Jun 2005 06:45:36 GMT  
 Displaying Access Reports from a VB 6 application
RE/

Quote:
>Hey everyone. I have been working on a program the last few weeks that
>handles day to day business functions here at work. I am trying to display
>an existing access report from a simple form with a button. Below is the
>code I used, which was taken verbatim from another post, however, it does
>not work for me. I get an error telling me that "user defined type not
>defined." It is not recognizing Access in my code. Am I missing something
>here? Did I skip a crutial step somewhere? I have never done this before.

>Private Sub Command1_Click()
>Dim Acc As access.Application              '*error occurs here
>Set Acc = New access.Application
>Acc.opencurrentdatabase "c:\windows\desktop\new\Lazer Database.mdb"
>Acc.docmd.openreport "Employee Job Pay", acpreview
>Acc.Visible = True
>Set Acc = New access.Application
>End Sub

I think that when that happened to me, it was because I forgot to put in a
reference to MS Access and VB didn't know about it or it's objects.

The concept is sound, though, because I've seen it done by others and done it
myself once or twice.
-----------------------
Pete Cresswell



Wed, 22 Jun 2005 08:23:10 GMT  
 Displaying Access Reports from a VB 6 application
I think you probably need to set your Refrences in the Visual Basic Project.

VB6 Menu Bar
    Project-->References

Check the 'Microsoft Access X.0 Objects' that is appropriate for your
version of Access.  9.0 = 2000, 10.0 = XP.

That should take care of your problem


Quote:
> Hey everyone. I have been working on a program the last few weeks that
> handles day to day business functions here at work. I am trying to display
> an existing access report from a simple form with a button. Below is the
> code I used, which was taken verbatim from another post, however, it does
> not work for me. I get an error telling me that "user defined type not
> defined." It is not recognizing Access in my code. Am I missing something
> here? Did I skip a crutial step somewhere? I have never done this before.

> Private Sub Command1_Click()
> Dim Acc As access.Application              '*error occurs here
> Set Acc = New access.Application
> Acc.opencurrentdatabase "c:\windows\desktop\new\Lazer Database.mdb"
> Acc.docmd.openreport "Employee Job Pay", acpreview
> Acc.Visible = True
> Set Acc = New access.Application
> End Sub

> Thanks

> Mike



Wed, 22 Jun 2005 09:16:38 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Displaying Access Reports from a VB 6 application

2. VB to Execute Access Report - Access report displayed on Web

3. Displaying pictures in reports or running Access reports from VB

4. How to display the Crystal Reports Report Design Component (RDC) in an ASP application

5. Displaying Access 2.O OLE field in VB application

6. Displaying Access reports from VB

7. Can VB 4 display/print Access Reports?

8. MDI - Displaying access reports from VB

9. Can VB 4 display/print Access Reports?

10. Displaying Access reports from VB

11. display an Access report with VB

12. Display Access Report in VB

 

 
Powered by phpBB® Forum Software