Results 1 to 6 of 6
  1. #1
    Join Date
    Mar 2005
    Posts
    12

    Unanswered: Passing Parameters to Report

    I have an intermediate form that allows for the entry of a From Date and a To Date for a report to be run for. I use these form variables in my query and the report is working beautifully.

    My problem is that I want to print the from and to date on the report header. No matter what I try, it doesn't seem to work. Any ideas?

    Steve

  2. #2
    Join Date
    Mar 2005
    Posts
    12
    Got it. I tried this previously, but must have typed something incorrectly.

    In the Control Source of a Text Box in the Report Header, I put:

    ="Measures Sold Report (" & Forms!reporting_parms_meas_sold!date_from.Value & " through " & Forms!reporting_parms_meas_sold!date_to.Value & ")"

  3. #3
    Join Date
    Apr 2004
    Location
    metro Detroit
    Posts
    634
    You can refer to the dates from your form in a textbox on your report using the same syntax as you used in your query.

  4. #4
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    make yourself a textbox on the report.
    in the textbox properties/data/control source, type:
    ="My from date was" & [Forms]![yourDateFormName]![FromDateTextBoxName]

    you should be done!

    izy
    currently using SS 2008R2

  5. #5
    Join Date
    Nov 2002
    Posts
    154

    Talking Use the open args of the openreport function instead

    Open up the VB editor for the button that you use to call the report. It should have a line that looks something like:
    docmd.openrpt stdocname
    If you put five commas after the stdocname (the name of your report) you will see in the intellisense of the VB editor that OpenArgs comes up. You can put anything there and pass it to the report to be opened. You could declare a string in code and set it to something like "From " & txtFromDate & " To " & txtToDate. Then you put this string in the OpenArgs of the docmd.OpenReport statement. Then in the OnOpen event of the report, you would declare a string and set it to me.OpenArgs if OpenArgs are not null. Then in the same event you set the caption of the label, lbl.caption = that string (which is OpenArgs). Enjoy!

  6. #6
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926

    Reports and dates

    This might be of some help (see attached.)
    Attached Files Attached Files
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

Posting Permissions

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