I’m using a Crystal ActiveX Report Viewer Control 10.0 on an MS Access form Crystal ActiveX Report Viewer Control 10.0. I’ve been able to set the report source and parameters and load the report and view it but I can’t set any properties except in code. The only property I’ve been able to really set is the height and width. Any properties that I set in the property sheet are not saved and when I view my form in form view the control shrinks right back up.
If I change DisplayToolBar to no or any other similar property to no in design view it gets changed right back to yes when I view the form.
When I view the report in form view the report displays a few inches to the left like it saving space for the group tree which always displays to the left. If I could get rid of the space to the left on the viewer I’d be happy.
I’m really excited about having crystal reports with MS Access because I need to do a lot of charts and graphs and crystal reports is much better than Access.
I’ve been looking for this for a long time and spent a lot of time searching and finally got something to work. I’m going to post my code in case someone else can use it.
Anyone know how to set the properties? Please!!
BTW I'm using Access 2010 and crystal reports 2011
Code:
Public crApp As CRAXDRT.Application
Public MyPrm As String
Private Sub cmdViewReport_Click()
MyPrm = Me.txtPart
Dim crReport As CRAXDRT.Report
Set crReport = crApp.OpenReport("C:\EdMcNeill\Test2.rpt")
Dim crTables As CRAXDRT.DatabaseTables
Set crTables = crReport.Database.Tables
crReport.ParameterFields.GetItemByName("EnterPartNumber").AddCurrentValue MyPrm
Me.Cr10.ReportSource = crReport
Cr10.ViewReport
End Sub
Private Sub Form_Load()
Me.Cr10.Height = 8008
Me.Cr10.Width = 11280
Set crApp = New CRAXDRT.Application
'Me.Cr10.Width = 4
'Me.Cr10.Height = 5
End Sub
I had to add one reference to my database
C:\Program Files\Common Files\Crystal Decisions\2.5\bin\craxdrt.dll