Results 1 to 6 of 6

Thread: Report Help

  1. #1
    Join Date
    Jan 2010
    Posts
    44

    Unanswered: Report Help

    I am making a report from a query. When I run the query I ask for the user to enter a order amount. How can I put that order amount enter in the WHERE clause of the SQL statement on the actual report after it produces the report?

    Example: User wants to know all Items greater than $20.00. I want to show on the report at the top: Enter Amount of All Items above _$20.00_

  2. #2
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    In the recordsource query of the report, add criteria under the appropriate field such as: >[Enter $ amount:] When the report is opened, the [Enter $ amount:] prompt will appear.

    Or you can utilize a form and have the user enter the $ amount on the form and base your report's recordsource query criteria against the form's unbound criteria fields (ie. you can then control what values are entered on the form before the button to open the report is pushed). There's a few of these types of examples in the code bank.

    I typically like to use the form method though since there's typically other criteria fields a user might want to enter. Then when the button to preview the report on the form is pushed, I minimize the form and open the report. On the report, I'll have a field with a control source: =Forms!MyCriteriaForm!MyCriteriaFieldName to show the criteria that was entered. (note: the form must be open/minimized to get the criteria value the user entered on the form to the report.)
    Last edited by pkstormy; 04-08-10 at 00:08.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  3. #3
    Join Date
    Jan 2010
    Posts
    44
    How do you get to the Code Bank?

  4. #4
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    It's the first (sticky) link in the MSAccess forums main page titled dbforums Code Bank (or click here: http://www.dbforums.com/microsoft-ac...code-bank.html)
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  5. #5
    Join Date
    Jan 2010
    Posts
    44
    Thanks. Is there a way you can right a normal query and have it look for the where clause from a form text box and then maybe produce a sub report withing a form?

  6. #6
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    Quote Originally Posted by tvb2727 View Post
    Thanks. Is there a way you can right a normal query and have it look for the where clause from a form text box and then maybe produce a sub report withing a form?
    I'm confused.
    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
  •