Results 1 to 2 of 2
  1. #1
    dysonju is offline Novice
    Windows 10 Access 2016
    Join Date
    Nov 2018
    Posts
    1

    Prompting for Date Entry then Showing only Records Within One Year

    I am trying to run a query that will only show me employees who have retired within a specified date range. I have used and expression to prompt for a date entry, then used the datediff function to calculate the difference between the "EffectiveDate" and the Entered Date. When I attempt to put a stipulation to only show records where the DateDiff is less than or equal to 365 days, I get propted to enter the "EndDate" again. Below is the Code....I only want to enter the date once.

    SELECT [Employee Status].EmployeeName, Employees.LastName, Employees.FirstName, Employees.MiddleName, Status.ID, Status.Status, [Employee Status].EffectiveDate, [Enter EOY Date as MM/DD/YYYY] AS EndDate, (Int(DateDiff("d",[EffectiveDate],[EndDate]))) AS CalculatedDateRange
    FROM Employees INNER JOIN (Status INNER JOIN [Employee Status] ON Status.ID = [Employee Status].Status) ON Employees.[Employee ID] = [Employee Status].EmployeeName


    WHERE (((Status.ID)=3) AND (((Int(DateDiff("d",[EffectiveDate],[EndDate]))))<=365));

  2. #2
    GinaWhipp's Avatar
    GinaWhipp is offline Competent Performer
    Windows 7 64bit Access 2013 32bit
    Join Date
    Jul 2011
    Location
    Ohio, USA
    Posts
    377
    Then I would use a Form with a field to enter the End Date with a button to open the Report.

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

Similar Threads

  1. Replies: 19
    Last Post: 01-24-2016, 07:48 PM
  2. Replies: 7
    Last Post: 06-07-2015, 11:57 PM
  3. Replies: 5
    Last Post: 03-09-2014, 07:16 PM
  4. Showing records based on certain date
    By mindbender in forum Queries
    Replies: 6
    Last Post: 05-06-2013, 04:27 PM
  5. How to display year season from date entry
    By Allaw212 in forum Access
    Replies: 3
    Last Post: 06-01-2010, 11:11 AM

Tags for this Thread

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