1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Displaying Report Filter in Report

Discussion in 'Business Applications' started by tomlock2, Dec 15, 2011.

Thread Status:
Not open for further replies.
Advertisement
  1. tomlock2

    tomlock2 Thread Starter

    Joined:
    Nov 20, 2011
    Messages:
    49
    What is the syntax for displaying the Report filter in the body of the Report if---

    1. The filter is set in VBA, in the DoCmd.OpenReport command OR

    2. The filter is set in the Report properties filter OR

    3. The filter is set in the query referenced as the data source to the report?

    Thanks in advance for help!!!
     
  2. OBP

    OBP

    Joined:
    Mar 8, 2005
    Messages:
    19,895
    You can either set the filter in to a Field or the text of a label during the On Format event, would that suffice?
     
  3. tomlock2

    tomlock2 Thread Starter

    Joined:
    Nov 20, 2011
    Messages:
    49
    Not sure what you meant. Let me clarify one of the options I'd like to use.

    In an onclick event on my form--

    Dim myfilter as string
    myfilter=inputbox("enter date you want here")
    myfilter=[birthday] & "=" & myfilter
    DoCmd.OpenReport "myreport -rpt", acViewPreview, , myfilter, acWindowNormal
    end sub

    I would want to display the value of the variable myfilter in the Heading of my report. What's the syntax of the text Box data source? Is it somthing like [=myfilter]?
    I would like to display the value of the variable "filter
     
  4. tomlock2

    tomlock2 Thread Starter

    Joined:
    Nov 20, 2011
    Messages:
    49
     
  5. Rockn

    Rockn

    Joined:
    Jul 29, 2001
    Messages:
    21,334
    Put a text box on the report and have the onLoad or onFormat event code something like Me.Textbox = myFilter
     
  6. OBP

    OBP

    Joined:
    Mar 8, 2005
    Messages:
    19,895
    myfilter would need to be declared as a Public Variable in a VBA Module so that it can be shared between the form and the report.
    However if the Form is filtered first to that date then you can use the Form's date field in the Report header by setting an unbound text box's Control Source to
    =Forms![formname]![datefieldname]
    where formname is the actual name of your form and datefieldname is the name of your birthday field
     
  7. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/1031349

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice