Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2012

    Unanswered: Search parameters from a form to print on the report

    My report takes its parameters from a form and it works. My user wants the parameters they used to generate the report to appear either on top or bottom of the report so that when they are reading the report they know what the search criteria was. For eg:Where a date From and Date To specified the report should say

    Date Range: 1/10/2012 - 31/10/2012

    Or where a category or sub-category is specified it should say
    Filtered by:
    Category - Electrical
    Sub-category - Sensor

    Could someone please suggest a code that I could put in to make this happen on the report.
    Database attached.
    Attached Files Attached Files

  2. #2
    Join Date
    Nov 2004
    out on a limb
    Provided Answers: 59
    Which form which report

    providing the form with the parameters is still open when the report runs then you can 'pull' the values from that form using soemthign like

    MyReportsVariable1 = forms!MyParameterFormName!MyControlName1.value
    MyReportsVariable2 = forms!MyParameterFormName!MyControlName2.value
    ... and so on
    ..natch you'd need to change the 'MyWhatevers' in the above with the correct names in your application

    if you declare
    MyReportsVariable1....n as public variables in the report, then I'd pull them fromt he parameter form in say the forms on Open event

    having done that stuff them into an unbound control in the reports page header/footer (on format event?) etc

    dim strReportParameters as string
    strReportParameters = "Parameters:-" & vbcrlf
    if (isnull(MyReportsVariable1 ) = false and MyReportsVariable1<>"") then
    strReportParameters = strReportParameters & "First parameter is:" & MyReportsVariable1 & vbcrlf
    ...and so on for MyReportsVariable2...n

    if strlen(strReportParameters) < 15 then 'bear in mind vbcrlf may add two characters,. dunno to be honest)
    strReportParameters = strReportParameters & "No Parameters set, all rows reported"

    depending on how you have set the report up you may well be able to parse the filter settings to get the same effect
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    May 2005
    Nevada, USA
    Provided Answers: 6
    Again presuming the form stays open, you don't need code. A textbox with a control source of


    will pull the value, or you can concatenate them into one:

    ="From " & forms!MyParameterFormName!MyControlName1 & " to " & forms!MyParameterFormName!MyControlName2

  4. #4
    Join Date
    Aug 2012
    Thanks, I will give it a shot.

    I basically want it for all reports.

    Fault reports and summary report forms. These two forms allow the user to enter parameters for various reports and run them.


Tags for this Thread

Posting Permissions

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