PDA

Click to See Complete Forum and Search --> : VB- Modify a report's textbox values


UsefulIdiot
Sep 13th, 2006, 04:21 PM
How would i set the value of a textbox on a report? it doenst look like you can access these values through me.report.somefield.value

thanks,
chris.

brucevde
Sep 13th, 2006, 04:55 PM
Crystal Reports????

If yes, it depends on your Version and Edition of Crystal. You can access almost anything via the Crystal Runtime Libraries. Set a reference to the proper library and then utilize the objects to manipulate your report at runtime.

For Version 8.5 set a reference to Crystal Reports 8.5 ActiveX Designer Run time Library. This sample code sets the Text of a Text Object control that is in the Page Header.

Private oCrystalApp As CRAXDRT.Application

Private Sub Command1_Click()
Dim oReport As CRAXDRT.Report
Dim oTextBox As CRAXDRT.TextObject

Set oReport = oCrystalApp.OpenReport("c:\northwind.rpt", 1)
Set oTextBox = oReport.Sections("Section1").ReportObjects("Text1")

oTextBox.SetText "Hello World"

'show the report in the Crystal Report Viewer Control.
CRViewer1.ReportSource = oReport
CRViewer1.ViewReport

Set oReport = Nothing
End Sub

Private Sub Form_Load()
Set oCrystalApp = New CRAXDRT.Application
End Sub

Private Sub Form_Unload(Cancel As Integer)
Set oCrystalApp = Nothing
End Sub