Results 1 to 4 of 4
  1. #1
    RhinoCan is offline Novice
    Windows 8 Access 2013
    Join Date
    Jun 2015
    Posts
    10

    Can I create reports that use runtime variables?

    I'm fairly new to Access and I'm trying to find out if it's possible to have a report that contains variables which drive what is in the report?



    Specifically, I have a table of Sales data where each row contains a single sale. The sale consists of a date (containing Year, Month and Day), an item, and a quantity. There are only a maximum of 4 different items sold by this business. I want my report to list only sales for a specific week, where I specify the begin and end dates of the week when I execute the report. In other words, the begin and end dates are unknown to the report when I execute it and it should prompt me for those values, then display them on the report. Therefore if I run the report today and want information about last week, I would specify a begin date of 2015-12-13 and and end date of 2015-12-20. When I run this report next week, I'll give it the begin and end dates for THIS week and get a report on what sales I had this week.

    Is that possible? I've been poking around in Access but don't see any options for variables like this.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    In full Access, design a form for users to pick dates, depts, and select a report.
    once entered, the query uses the items in the form to pull the data.
    The user picks a report name from a list box, adds a date range if needed.

    then Runtime can run these.

  3. #3
    RhinoCan is offline Novice
    Windows 8 Access 2013
    Join Date
    Jun 2015
    Posts
    10
    Quote Originally Posted by ranman256 View Post
    In full Access, design a form for users to pick dates, depts, and select a report.
    once entered, the query uses the items in the form to pull the data.
    The user picks a report name from a list box, adds a date range if needed.

    then Runtime can run these.
    Thank you for confirming that what I want is possible; that's half the battle right there ;-)

    I've put together a form that prompts for the dates - I display them in a list box so that the user can select the one he wants - and have created a RUN button that, when pressed, executes the query that gets the data. I'm not clear one critical thing though: how do I get the two selected dates (the date the week began and the date the week ended) to the query so that it only gets the rows for that week?

    If it's too involved to describe in a post, I'd be perfectly happy if you could point me to a tutorial or video that shows how to get a variable from a form and pass it to a query.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Review http://datapigtechnologies.com/flash...mtoreport.html

    I don't use dynamic parameterized queries. I prefer VBA to build filter string http://www.allenbrowne.com/ser-62.html
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Using Public variables between forms/queries/reports
    By dcrake in forum Sample Databases
    Replies: 2
    Last Post: 12-25-2015, 05:44 PM
  2. Cannot create Global Variables
    By Paul H in forum Programming
    Replies: 3
    Last Post: 05-20-2014, 11:27 AM
  3. Replies: 5
    Last Post: 03-18-2014, 04:56 PM
  4. Create a form with variables and constants
    By smcnair_wtc in forum Forms
    Replies: 2
    Last Post: 01-08-2013, 10:54 PM
  5. Reports and variables, problems
    By _Boo in forum Reports
    Replies: 3
    Last Post: 06-23-2011, 01:08 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums