Results 1 to 10 of 10
  1. #1
    softspoken is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Mar 2010
    Posts
    61

    wanting to subtract a date from the current date.....

    I have a database where a table will be imported and it has a date field that i want to be able to subtract from the current date. With in a query is it possible to code it where it looks for the date in the table and where ever there is a date it subtracts that date by the current date the query is ran? I hope thats not confusing. When the table is imported it will not have a field that is labled "current date" but i am hoping there is a code or something that I can use that will look at the date that is within the table imported and subtract it by the current date the query is ran. Please help if anyone thinks they can ... thanks ....

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    You can use the DateDiff() function for the subtraction (pure subtraction would probably work, but is less flexible). You can use the Date() function to get the current date from the system.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    softspoken is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Mar 2010
    Posts
    61

    thanks for the quick reply

    I will try that . Thank you .

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    No problemo; post back if you get stuck. Welcome to the site by the way!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    softspoken is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Mar 2010
    Posts
    61
    this is the code i am trying to use but its giving me an error. Can you pick out whats wrong with it. It ask me for the date and I key that in and it gives me #error . Thanks

  6. #6
    softspoken is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Mar 2010
    Posts
    61
    Cycle Time: nz([AppDate],0)-[Now()]

  7. #7
    softspoken is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Mar 2010
    Posts
    61
    I also tried [Date()]

  8. #8
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Don't bracket the function. It makes Access think it's one of your fields.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  9. #9
    softspoken is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Mar 2010
    Posts
    61
    that worked ... thank you very much for your help ... im sure ill be back with more lol ..

  10. #10
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    No problemo, and welcome to the site by the way.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. VB coding to show current date n time in access form
    By cwwaicw311 in forum Programming
    Replies: 6
    Last Post: 02-10-2010, 09:53 PM
  2. Current Date Error
    By McFly in forum Database Design
    Replies: 4
    Last Post: 02-04-2010, 09:08 AM
  3. Replies: 2
    Last Post: 07-31-2009, 06:56 AM
  4. Changing a date to the current year
    By fdnyfish in forum Access
    Replies: 1
    Last Post: 03-01-2008, 08:34 AM
  5. Replies: 1
    Last Post: 12-09-2005, 10:29 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