Results 1 to 2 of 2

Thread: VB- Modify a report's textbox values

  1. #1

    Thread Starter
    Member
    Join Date
    Jul 2006
    Posts
    54

    VB- Modify a report's textbox values

    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.

  2. #2
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    Re: VB- Modify a report's textbox values

    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.

    VB Code:
    1. Private oCrystalApp As CRAXDRT.Application
    2.  
    3. Private Sub Command1_Click()
    4.     Dim oReport As CRAXDRT.Report
    5.     Dim oTextBox As CRAXDRT.TextObject
    6.    
    7.     Set oReport = oCrystalApp.OpenReport("c:\northwind.rpt", 1)
    8.     Set oTextBox = oReport.Sections("Section1").ReportObjects("Text1")
    9.  
    10.     oTextBox.SetText "Hello World"
    11.    
    12.     'show the report in the Crystal Report Viewer Control.
    13.     CRViewer1.ReportSource = oReport
    14.     CRViewer1.ViewReport
    15.  
    16.     Set oReport = Nothing
    17. End Sub
    18.  
    19. Private Sub Form_Load()
    20.     Set oCrystalApp = New CRAXDRT.Application
    21. End Sub
    22.  
    23. Private Sub Form_Unload(Cancel As Integer)
    24.     Set oCrystalApp = Nothing
    25. End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width