Results 1 to 4 of 4
  1. #1
    cpbittner is offline Novice
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    11

    Question Updating a date field in a record using a number field in that same record

    Newbie. I have a set of records that I need to develop a way, perhaps a button on each record, that would call a method or macro that would take a number that is in one field of the record [frequency], and increment a date field [nextJobDate] by adding the [frequency] value to the [lastJob] date field, all of these fields are in the same record.



    As a newbie, I need guidance on how to best start, I know the AddDate function should be used, but am not sure how to update a record field using that function by referencing another field which has the incremental value. Any good URLs I can reference would be greatly appreciated as well.

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,928
    Why save the calculated value? Just calculate when needed. What is the frequency unit (day, month, year)? If day don't need function, day is default when adding a value to a date. Otherwise use DateAdd function. Access Help has info.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    cpbittner is offline Novice
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    11
    The dates are recommendations but require occasional manual updates indicating when the job is actually done, or rescheduled. I will use VB to write code to make this change, I'll post further if I run into issues doing that.

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,928
    Yes, will require code to save calculated value. If the field is included in form RecordSource, could be as simple as:

    Me!fieldname = Me.textboxname

    The real trick is figuring out what event to put the code in.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Replies: 6
    Last Post: 12-11-2012, 09:40 PM
  2. Replies: 9
    Last Post: 02-28-2012, 01:45 PM
  3. Replies: 1
    Last Post: 12-02-2011, 09:56 AM
  4. Updating field goes to wrong record
    By chrismalan in forum Forms
    Replies: 7
    Last Post: 03-20-2011, 08:07 PM
  5. Code to display latest record number field created?
    By rowardHoark in forum Programming
    Replies: 1
    Last Post: 01-31-2011, 08:03 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