Results 1 to 5 of 5
  1. #1
    Bloberoonie is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Feb 2012
    Posts
    3

    Need help with a date related query

    Hi Everyone,



    Brand new to access and need a bit of help. I run a business where a person takes a training course [date Taken] and then has an [valid to] date. What I need to do is to be able to run a query that will tell me two months in advance, all the candidates whos training needs renewing. Some courses are valid for 1 year others 3 so I'm not sure if I need to include another field for this or if the query will work just becuse of the [valid to] field.

    I have tried to create the criteria/expression but to no avail. Can anyone help with this?

    Steve

  2. #2
    alansidman's Avatar
    alansidman is offline Indifferent
    Windows 7 32bit Access 2007
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,536
    Here is one solution that will tell you how may days to expiration.
    Code:
    SELECT Table1.[valid to], DateDiff('d',Date(),[valid to]) AS [Days to Expiry]
    FROM Table1;
    Change the table name to yours. As a word of advise in field names, I would avoid using spaces. It may be a thorn in your side in the future. Prefer to use name ie. ValidTo and DateTaken. Same for Table Names

    You can then put this in the criteria for the Days to Expiry Field: < 60

  3. #3
    Bloberoonie is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Feb 2012
    Posts
    3
    Hi,

    Many thanks for the answer, can I just ask where I put the code? i.e in the query criteria or in an expression?

    My table name is [course candidates]

    Thank you

  4. #4
    alansidman's Avatar
    alansidman is offline Indifferent
    Windows 7 32bit Access 2007
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,536
    That is a SQL Statement. You would open the query in Design view and then switch to SQL View. Copy the code into the SQL statement using your table name. Then switch back to design mode and edit the query as necessary (ie. add additional fields if needed, etc.)

  5. #5
    Bloberoonie is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Feb 2012
    Posts
    3
    Thank you so much! that did it!

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

Similar Threads

  1. Replies: 1
    Last Post: 07-13-2011, 11:30 AM
  2. FIFO inventory related query - Help!
    By BamaBBQ1 in forum Queries
    Replies: 3
    Last Post: 04-25-2011, 04:20 PM
  3. Query on related tables question
    By jpkeller55 in forum Access
    Replies: 12
    Last Post: 09-28-2010, 07:18 PM
  4. Query with related tables question
    By jpkeller55 in forum Access
    Replies: 4
    Last Post: 09-25-2010, 04:29 AM
  5. Date Related Validation
    By ldare2000 in forum Access
    Replies: 1
    Last Post: 11-12-2009, 10:49 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