PDA

View Full Version : VB and Access Report


zadjali2000
07-14-2003, 06:05 AM
Hi guys,

Is there any way to connect VB form with access report(even opening access interface is good to me)

Cuz i have this big report that is best made and organized with access than crystal reports. and now i want to know how at least to open the report by pressing a button in VB

That's all and thank u all:thumbsup:

zak2zak
07-28-2003, 06:01 PM
May be this will help..
I've got it from VB site
.....................................
'Make sure you add references to Microsoft Access Object Library 8.
'This sample requires Access Installed (Access 97 prefered)
'You may have different versions of Microsoft Access Object Library
'Just check the proper one using the references option from Project menu.

Dim AccessApp As Access.Application

Private Sub cmdShowRpt_Click()
On Error Resume Next
Set AccessApp = New Access.Application

With AccessApp
.OpenCurrentDatabase App.Path & "\VBrpt.mdb"
.RunCommand acCmdZoom100
.RunCommand acCmdAppMaximize
.DoCmd.OpenReport "Employee", acViewPreview
End With
End Sub

Private Sub Form_Unload(Cancel As Integer)
On Error Resume Next
With AccessApp
.CurrentDb.Close
.Quit
End With
End Sub

Enjoy..!:thumbsup: