Results 1 to 4 of 4
  1. #1
    Natiq is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Sep 2013
    Posts
    2

    Find the diference between a start date and today

    Hello,



    I would have thought this to be pretty easy but I have hit a road block. I have a very small database and would like to be able to find out how many days something has been running. I have field called start and either need a way to auto-update a "Today's Date" field or just run a formula at form load the will calculate now()-[Start]. I have a calculated field called "total days" with the formula [Today's Date]-[Start] and it works just fine but you have to manually update the "today's date" field.

    Any suggestions are welcome and thank you.

    Natiq

  2. #2
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    Other than having the default value on the field (table) as Now() or Date() do you want this as code so that when you have an event like "open form" it makes the field [NameOfField] = Date()

    ?

    You could have [NameOfField]= [TotalDays] on open form event...

    Also in a query and rather a table (form record source) you can have a calculated field with any number of customized expressions/code without having to add it to the table...

  3. #3
    Natiq is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Sep 2013
    Posts
    2
    I thank you very much for the reply. Perhaps I was overthinking it as I had tried putting that formula in the "Load Form" event procedure except I had use the "Now ()" and it seemed to just fail.

    Once again thank you very much for your help.

  4. #4
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Since this is a Calculated Field, it shouldn't be stored, so in the Control Source for your 'days running' Control use this

    =Date()-[Start]

    or better yet, use the DateDiff() Function:

    =DateDiff("d",[Start],Date())

    Linq ;0)>

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

Similar Threads

  1. Replies: 3
    Last Post: 02-04-2013, 05:24 PM
  2. Replies: 7
    Last Post: 01-28-2013, 05:21 PM
  3. Replies: 3
    Last Post: 10-16-2012, 04:19 PM
  4. Replies: 5
    Last Post: 10-12-2012, 11:00 AM
  5. Replies: 12
    Last Post: 04-26-2012, 04:01 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