Hello all,
so if I have a report on Access, can I call it and place it the same in VB as if it was on Access?
Thanks
Printable View
Hello all,
so if I have a report on Access, can I call it and place it the same in VB as if it was on Access?
Thanks
You can either
- automate MS Access to run that report directly (Access must be installed)
- or create new report in VB similar to one in Access using any available report designer (DataReport, Crystal Reports, Active Reports, etc)
so how can automate access?
Something like this will do it:
VB Code:
Public Sub RunAccessReport(strDB As String, strReport As String, _ Optional strFilter As String = "", _ Optional strWhere As String = "") '=================================================================== Dim AccessDB As Object Set AccessDB = CreateObject("Access.Application") AccessDB.OpenCurrentDatabase strDB AccessDB.DoCmd.OpenReport strReport, acViewPreview, strFilter, strWhere AccessDB.Visible = True End Sub 'usage: Private Sub Command1_Click() RunAccessReport App.Path & "\nwind.mdb", "Catalog" End Sub
Moved to reporting section