Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2014
    Location
    Cork Ireland
    Posts
    1

    Run a previously created Multiple times for a date range

    Hi to all, Newbie here, looking forward to posting help where i can and getting to speak with some of you,



    have searched the web high and low for this, but i could be entering the wrong question or keywords but ill give it a shot at explaining.

    essentially i work with a database that has been created long before i got here with many many reports already in place. Some days i have to run the same report 14 times to get 14 days worth of data....

    im wonder via VBA can i get the system to run a date range for me.

    if i enter 1/1/14 00.00 - 1/1/14 23.59 to 14/1/14 00.00 - 14/1/14 23.59.

    essentially i dont want to go playing around with the report but i have no fear of getting stuck into the vb. I would be slightly above beginner stage of VBA, no database/sql work experience (just hobby grade stuff)

    many thanks
    D
    Last edited by unreal_event_horizon; 08-28-2014 at 02:32 AM. Reason: Can a mod edit my post title to put REPORT after the word CREATED. Thank you

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    You dont need vba, you can assign it in a query:
    in the criteria:
    between #1/1/14# and #14/1/14 23.59#

  3. #3
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    You could do the entire thing via VBA but it may be easier to Right Click Copy the Query Object that is the Record Source of the report and paste a copy of the Query Object in the Access Navigation Pane (the pane is the thing on the left where all of the forms, tables, reports are).

    I mention this because it seems your query for the report is already restrictive. So the SQL will need to be edited. Maybe you can start by posting the SQL here so we can see it. You can access the SQL via SQL View of the Query Object.

  4. #4
    IslandHydro is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Oct 2013
    Location
    Whidbey Island, Washington State, USA
    Posts
    21
    Try this:

    For myDate = StartDate to EndDate
    DoCmd.OpenReport "rptName",acViewNormal,,"Format(rptDate,'mm/dd/yy')=" & format(myDate,"mm/dd/yy")
    Next myDate

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

Similar Threads

  1. Multiple Entry Date Range Search
    By setnaffa in forum Queries
    Replies: 3
    Last Post: 08-12-2014, 10:22 AM
  2. Replies: 3
    Last Post: 03-11-2014, 07:32 PM
  3. Date Range Report with Multiple Date Fields
    By StevenCV in forum Reports
    Replies: 13
    Last Post: 02-29-2012, 08:29 AM
  4. Multiple Field & date range filter
    By mrkandohi001 in forum Reports
    Replies: 6
    Last Post: 01-18-2012, 03:11 AM
  5. Query with multiple date range constraints.
    By younggunnaz69 in forum Queries
    Replies: 2
    Last Post: 12-26-2011, 10:45 AM

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