Can i run a report created in Access fron VB. If i can how can i do it?
Printable View
Can i run a report created in Access fron VB. If i can how can i do it?
If you're using Access 2000 and newer then you cannot run Access report as stand along - you will need to automate Access:
If you're using Access 97 then it should be an ocx out there from a third party to do that.VB Code:
Private Sub Command1_Click() '======================= RunAccessReport App.Path & "\nwind.mdb", "Catalog" End Sub Public Sub RunAccessReport(strDB As String, strReport As String) '================================================================ Dim AccessDB As Access.Application Set AccessDB = New Access.Application AccessDB.OpenCurrentDatabase strDB AccessDB.DoCmd.OpenReport strReport, acViewPreview AccessDB.Visible = True AccessDB.Quit acQuitSaveAll Set AccessDB = Nothing End Sub
You can use the same automation techinques with Access 97. That is where I first learned how. (For that matter, you can use this with Access 95 providing you are equipped with the proper references.)
If you take a look at the Access VBA help, there's a DoCmd.OpenReport method which'll help you out...
Oh, certainly. This can be used with any version of Access as long as the refences are OK.Quote:
You can use the same automation techinques with Access 97