Results 1 to 4 of 4
  1. #1
    bbanks2 is offline Novice
    Windows Vista Access 2007
    Join Date
    Dec 2012
    Posts
    2

    Help - Query Dealing with Dates!!

    Hello,



    I need help creating a query. I really don't know where to begin with this one. I would like the query to pull records (audits) that are 365 days past its "Actual Start Date (field)". There are about 150 audits and each audit can have a different "Actual Start Date."

    Here is the information in the database:

    Table Name: Manager
    Field: AuditNum
    Field: ActualStartDate

    Table Name: ManagerStatus
    Field: Reason
    Field: ActionPlan

    Ideal query output (for records over 365 days):

    AuditNum ActualStartDate Reason ActionPlan

    Any help is greatly appreciated!!!! Thank you!!

  2. #2
    jzwp11 is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2010
    Location
    Dayton, OH
    Posts
    2,901
    First, how are the Manager and ManagerStatus tables related? I do not see a field in each that would make a join.

    As to the criteria of pulling records where the difference between today's date and the actualstartdate is >365 that is fairly easy. You will need a couple of built-in functions. The date() function, just returns the current date (based on your system date). The datediff() function finds the difference between two dates. The function can return the number of days (d), years (yyyy), or months (m) etc. depending on which option you use in the first term. Since you mentioned 365 day, I am using the days option ("d") in the function:

    WHERE datediff("d",actualstartdate, date())>365

  3. #3
    bbanks2 is offline Novice
    Windows Vista Access 2007
    Join Date
    Dec 2012
    Posts
    2
    Thanks for your response jzwp11! This worked. Problem Resolved!!

    The Manager and ManagerStatus tables are linked by "AuditNum."

  4. #4
    jzwp11 is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2010
    Location
    Dayton, OH
    Posts
    2,901
    Ok, you would bring both tables into the query and join them via the auditnum field. Then add a calculated field datediff("d",actualstartdate, date()) with the criteria of >365.

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

Similar Threads

  1. Query input dates for range of dates in two fields
    By kagoodwin13 in forum Queries
    Replies: 3
    Last Post: 02-13-2012, 04:25 PM
  2. Help dealing with duplicate records
    By jswenson3 in forum Access
    Replies: 12
    Last Post: 02-01-2012, 10:17 AM
  3. Replies: 3
    Last Post: 01-30-2012, 09:57 AM
  4. Dealing with Short Time format
    By hawkins in forum Access
    Replies: 0
    Last Post: 08-16-2011, 11:46 AM
  5. Having trouble dealing with these textboxes
    By blacksaibot in forum Programming
    Replies: 2
    Last Post: 04-28-2010, 12:10 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