Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Report Viewer won't show updates to Text Object

Status
Not open for further replies.

catalina36

Programmer
Aug 28, 2000
36
US
How do you get the Report Viewer to show changes that you programmatically make to Text Objects via VB at run-time? When I run the following code, the changes I make to the recordset are shown in the Report Viewer as expected, but the changes to the Text Object are not shown. In case it matters I’m using VB 6.0 and Crystal Reports 8.0.

Can anybody help a newbie to CR?

‘********* Here’s the code ***********

Dim Report As New CrystalReport1
Dim db As DAO.Database
Dim rs As DAO.Recordset


Private Sub cmdChangeData_Click()
‘Toggle data between IL and CT

Static intSwitch As Integer

If intSwitch Then
Set rs = db.OpenRecordset("SELECT * FROM Customer WHERE Region = 'Il'", dbOpenSnapshot)
Report.Text5.SetText "Region: Il"
Else
Set rs = db.OpenRecordset("SELECT * FROM Customer WHERE Region = 'Ct'", dbOpenSnapshot)
Report.Text5.SetText "Region: Ct"
End If

intSwitch = 1 - intSwitch

On Error GoTo ErrorHandler

Report.Database.SetDataSource rs
CRViewer1.Refresh
Exit Sub

ErrorHandler:
MsgBox "You have an error on Refresh"
Resume Next

End Sub


Private Sub Form_Load()

Set db = DBEngine.Workspaces(0).OpenDatabase("C:\Program Files\Seagate Software\Crystal Reports\Samples\Databases\xtreme.mdb", False)
Set rs = db.OpenRecordset("SELECT * FROM Customer WHERE Region = 'Ct'", dbOpenSnapshot)

Report.Database.SetDataSource rs

Screen.MousePointer = vbHourglass
Report.Text5.SetText "Region: Ct"
CRViewer1.Zoom 1
CRViewer1.ReportSource = Report
CRViewer1.ViewReport
Screen.MousePointer = vbDefault

End Sub


 
Please disregard my question. I just realized that my problem was the result of some code I had placed in a format event while experimenting with the RDC. There’s three hours of my life that I’d like to have back!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top