Help with data report


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Help with data report

  1. #1
    shannan Guest

    Help with data report


    Can you pass a variable from a form to a data report? I need to change a
    company name on a data report based upon what the user picks on a form.
    I have dim'd the variable as public but can not get the data report to recognize
    it. Can this be done?

    Thanks,

    Shannan


  2. #2
    Russ Guest

    Re: Help with data report


    "shannan" <slandreth@riverbarges.com> wrote:
    >
    >Can you pass a variable from a form to a data report? I need to change

    a
    >company name on a data report based upon what the user picks on a form.


    >I have dim'd the variable as public but can not get the data report to recognize
    >it. Can this be done?
    >
    >Thanks,
    >
    >Shannan
    >


    Shannan,
    You might want to use a Property Get rather than a Public variable, it's
    a little cleaner. Try something like this-

    In your form module, add a Property Get to pass the Company Name to the report:
    (Assuming you are using a ComboBox to let the user choose the company name)

    Public Property Get CompanyName() As String
    CompanyName = cmbCompanyName.Text
    End Property


    Then, in the DataReport_Initialize event do something like this:
    (This assumes that your Company Name label is in the "PageHeader" section
    of your report).

    Private Sub DataReport_Initialize()
    Dim lbl As RptLabel

    With rptMyReport.Sections("PageHeader")
    Set lbl = .Controls("lblCompanyName")
    lbl.Caption = frmMyForm.CompanyName
    Set lbl = Nothing
    End With

    End Sub

    HTH,
    -Russ.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center