Skip to Content
0
Former Member
Jun 07, 2009 at 05:29 PM

Run CR XI report from VBA code in Access 2007

346 Views

Is there a code sample available for launching a CR XI report from VBA code in Microsoft Access 2007? Specifically, I am looking for the References I need to include in my MDB file, as well as the code to launch the RPT.

I reviewed the RDC_VBA samples for CR v8 and v9, but they don't seem to work for XI. Is there an XI sample available?

Here are the references I've added to my MDB:

Crystal ActiveX Report Viewer Library 11.0

c:\Program Files\Common Files\Business Objects\3.0\crystalreportviewers11\ActiveX Controls\CRviewer.dll

Crystal Reports ActiveX Designer Design and Runtime

c:\Program Files\Common Files\Business Objects\3.0\bin\craxddrt.dll

And here is the code snippet I'm using, and get an error on the Dim statement ("User-defined type not defined").

Private Sub Form_Open(Cancel As Integer)

Dim rep As New CrystalReport

rep.ReportFileName = "p:\test.rpt"

crViewer.ReportSource = rep

crViewer.ViewReport

End Sub

Thanks much.