+ Reply to Thread
Results 1 to 5 of 5

How to get all records from a start date to an end date.

  1. #1
    Registered User
    Join Date
    11-17-2011
    Location
    South Africa
    MS-Off Ver
    Access, Excel 2010
    Posts
    52

    How to get all records from a start date to an end date.

    Hi,

    I have a form (unbound) with a start date and an end date to get a report to give me the members on leave for that period. Every thing works fine but when a member is on leave from 2014/06/01 to 2014/06/10, and I enter a start date of 2014/06/03 and end date of 2014/06/04, I get a blank report. What I want instead is for the report to give me the members name because he was on leave in that time frame. I hope it makes sense. I want access to store all the days between 2014/06/01 and 2014/06/10 and not just the two dates entered in the start and end dates.

    I have a table [tbl_Leave_Records] with the [leavestartdate], [leaveenddate], [leavetype] and [paynumberFK]. I have a query [qry_Leave_Records] from that table, the unbound form [frm_Leave_Dates] to filter by start date, end date and paynumber and a report [rpt_Leave_Records] that gives me the results.

    Thank you

  2. #2
    Forum Contributor pareshj's Avatar
    Join Date
    05-20-2014
    Location
    MUMBAI
    MS-Off Ver
    2007 & 2010
    Posts
    447

    Re: How to get all records from a start date to an end date.

    Hi,

    Try the below query, use # for presenting dates in Access.

    "select * from [tbl_Leave_Records]
    where [leavestartdate] >= # " & startingdate & " # and
    [leaveenddate] <= # " & enddate & " #"

    Where,
    startingdate = Your Leave Start Date
    enddate = Your Leave End Date



    Regards,
    Paresh J
    Click on "* Add Reputation" as a way to say thanks

  3. #3
    Registered User
    Join Date
    11-17-2011
    Location
    South Africa
    MS-Off Ver
    Access, Excel 2010
    Posts
    52

    Re: How to get all records from a start date to an end date.

    This is the code I have on the run report button to give me the values for the start date and end date:

    Please Login or Register  to view this content.

  4. #4
    Forum Contributor pareshj's Avatar
    Join Date
    05-20-2014
    Location
    MUMBAI
    MS-Off Ver
    2007 & 2010
    Posts
    447

    Re: How to get all records from a start date to an end date.

    Hi,

    Debug the code and check what goes in as StartDate and EndDate.
    Also, check when you apply formatting on date with strcJetDate, whether it gets actually applied as you want them to.



    Regards,
    Paresh J

  5. #5
    Registered User
    Join Date
    11-17-2011
    Location
    South Africa
    MS-Off Ver
    Access, Excel 2010
    Posts
    52

    Re: How to get all records from a start date to an end date.

    The above code works. I got it from another source. My dilemma is as follow: The leave database started out by adding each date the member was on leave into the system. IOW, if a member was on leave for 10 days, you have to capture 10 records or days (entries). I changed that by adding a start date and end date but access doesn't store the dates in between, it just stores the start date and end date. How can I get the dates in between the start date and end date to be recorded as well?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 1
    Last Post: 05-26-2014, 03:46 AM
  2. Calculate next due date based on start date frequency and current date
    By ironoverload in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 03-09-2014, 07:08 AM
  3. Replies: 1
    Last Post: 10-02-2012, 02:42 PM
  4. Replies: 2
    Last Post: 01-04-2012, 09:15 AM
  5. Replies: 7
    Last Post: 11-16-2008, 05:48 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1