Results 1 to 5 of 5
  1. #1
    accesskid is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2011
    Posts
    17

    Trying to Automatically update date within form

    I am family with the refresh and requiry for dates but what i am looking to do is;

    in my database i have a number of assets and want to

    automatically update the replacement date by using the purchased date

    and life cycle of the asset.

    I have came up with this and its not working so need help if anyone knows the correct code.



    Me.Replacement_Date = DateAdd(Me.Purchased_Date, Me.LifeCycle, Me.Replacement_Date) = Now

    thank you

  2. #2
    NTC is offline VIP
    Windows Vista Access 2007
    Join Date
    Nov 2009
    Posts
    2,392
    Me.Replacement_Date = DateAdd(Me.Purchased_Date, Me.LifeCycle, Me.Replacement_Date) = Now

    well you can't have me.replacement date twice....and that = Now also can't be there.....

    so if the me.lifecycle is in quantity of days? ....then you simply add lifecycle days to purchased date - - and that's it....

  3. #3
    accesskid is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2011
    Posts
    17
    yeah i see what your saying but im struggling to grasp what the code is going to look like to add the dates together and the lifecycle is simply in years, could you possibly help me with an example.............

  4. #4
    NTC is offline VIP
    Windows Vista Access 2007
    Join Date
    Nov 2009
    Posts
    2,392
    research the DateAdd method ; and do a couple of simple math trials in your application to verify it works - so you have a handle on that syntax.

    then you need only convert years to days with something like:
    Dim LifeCycleDays as Integer
    LifeCycleDays = Me.LifeCycle * 365

    and you use LifeCycleDays in your DateAdd formula.

    Hope it helps.

  5. #5
    accesskid is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2011
    Posts
    17
    I have managed to do it thanks a different way by working it out, thanks anyway

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

Similar Threads

  1. Replies: 4
    Last Post: 04-18-2011, 07:18 AM
  2. Automatically update field
    By Top Fuel Friday in forum Forms
    Replies: 3
    Last Post: 02-12-2011, 12:14 PM
  3. How to update fields automatically
    By kosan in forum Forms
    Replies: 1
    Last Post: 09-10-2010, 04:49 PM
  4. Automatically update datasheet
    By tammiep in forum Forms
    Replies: 1
    Last Post: 08-17-2010, 04:43 PM
  5. Help Automatically running and Update Query
    By JohnRandolphSTL in forum Queries
    Replies: 8
    Last Post: 04-13-2010, 02:08 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