Results 1 to 8 of 8
  1. #1
    YaseenIskaf is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Aug 2012
    Posts
    14

    need help to creat a Query for Futre date?


    Kindly I need a help to create a query which is showing the Employees’ documents Expiration after 2 Months from the System date?

    for Example I need to sort out all the employees which their passport will expired after 2 Months (with out to Enter the no of month)

    thanks all

  2. #2
    recyan's Avatar
    recyan is offline Expert
    Windows 2K Access 2000
    Join Date
    Dec 2011
    Posts
    662
    Let us say, we have :

    PassportID | DateOfExpiry | DateAfter2Months
    1 | 10/18/2012 | 10/18/2012
    2 | 9/18/2012 | 10/18/2012
    3 | 11/18/2012 | 10/18/2012

    Which PassportID's do you want the query to show ?
    1) If the data is not proper or sufficient to explain the problem, pls post some data & the results you want.
    2) Additionally, you can check out : Date(), DateAdd() and IIf()

    Thanks

  3. #3
    YaseenIskaf is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Aug 2012
    Posts
    14

    need help to creat a Query for Futre date?

    thank you recyan Dear for your reply ASAP

    i will give you an example below and i will use today date as a System date

    Passport NO | Expiry date
    1 | 17/6/2012 (past date to be Show)
    2 | 17/8/2012 (Curent date to show)
    3 | 20/9/2012 (in Betewwn to show)
    4 | 17/10/2012 (till 2 Months to show)
    5 | 18/10/2012 (more than 2 Months to not show)

    for 1 and 2 it is <= date()
    but how for the all records which will expired untill next 2 months

    thank you again

  4. #4
    recyan's Avatar
    recyan is offline Expert
    Windows 2K Access 2000
    Join Date
    Dec 2011
    Posts
    662
    Check out if below gives some guidelines.

    Code:
    SELECT 
        tblPassports.PassportID, 
        tblPassports.DateOfExpiry, 
        DateAdd("m",2,Date()) AS DateAfter2Months, 
        IIf([DateOfExpiry]>=[DateAfter2Months],"Do Not Show","Show") AS CheckIfWithin2Months
    FROM 
        tblPassports;
    Code:
    SELECT 
        tblPassports.PassportID, 
        tblPassports.DateOfExpiry, 
        IIf([DateOfExpiry]>=DateAdd("m",2,Date()),"Do Not Show","Show") AS CheckIfWithin2Months
    FROM 
        tblPassports
    WHERE 
        (
            (
                (IIf([DateOfExpiry]>=DateAdd("m",2,Date()),"Do Not Show","Show"))="Show"
            )
        );
    Thanks

  5. #5
    YaseenIskaf is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Aug 2012
    Posts
    14
    thank you
    your answered support me to find it

    this code <=DateAdd("m",2,Date())

    I tried and works same how i need the result

    Thank You again

  6. #6
    recyan's Avatar
    recyan is offline Expert
    Windows 2K Access 2000
    Join Date
    Dec 2011
    Posts
    662
    Glad you found it helpful.

    Thanks

  7. #7
    YaseenIskaf is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Aug 2012
    Posts
    14
    Dear how to solve this problem with my db which i created by Access 2007 but doesn`t works with other system 2010 or even 2007 the Error box saing (Your Micrsoft office Access db or project contains a missing or broken reference to the file 'RulesEngine.dll' version 1.0.
    and other View *.dll files all the Query order related to the Date not working
    the db workes only in the same system which was created by with Access 2007 but even in other computer with same Access 2007 doesnt workes

    please help me to solve my problems

  8. #8
    recyan's Avatar
    recyan is offline Expert
    Windows 2K Access 2000
    Join Date
    Dec 2011
    Posts
    662
    Would suggest starting a new thread in appropriate forum, as this is a different problem.
    You will get more responses.
    Do not know if the Mod's can split this thread & start a new one for above.


    Edit : Noticed, you have already started a new thread
    https://www.accessforums.net/program...lem-27546.html

    Thanks

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

Similar Threads

  1. Replies: 0
    Last Post: 11-22-2011, 09:22 PM
  2. query to update a date based on another date
    By tkendell in forum Access
    Replies: 3
    Last Post: 06-29-2011, 09:32 PM
  3. how to creat purchase order
    By arctushar@yahoo.com in forum Access
    Replies: 5
    Last Post: 10-07-2010, 08:14 PM
  4. Replies: 7
    Last Post: 09-22-2010, 02:32 PM
  5. Replies: 2
    Last Post: 07-31-2009, 06:56 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