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?
Re: Help with data report
"shannan" <firstname.lastname@example.org> wrote:
>Can you pass a variable from a form to a data report? I need to change
>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?
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
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
Set lbl = .Controls("lblCompanyName")
lbl.Caption = frmMyForm.CompanyName
Set lbl = Nothing
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center