DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2
  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.

Bookmarks

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


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links