Results 1 to 14 of 14
  1. #1
    gaker10 is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2014
    Posts
    262

    Timestamp based on a field only

    I have a table of parts, their descriptions etc. I also have (or will have) several price fields. I will add a field to my table for each price that will have a date timestamp on when it was added and/or edited. I will limit the number of different prices to 3 (PriceA, PriceB, PriceC) and the 3 corresponding dates (DateA, DateB, DateC).



    For example, PriceA is added to PartA, timestamp it in DateA. PriceB is added to PartA, timestamp it in DateB. PriceA for PartA is edited, overwrite DateA with the new date. I only want this to happen when the Price field is edited or added, not when the entire record is added or edited.

    I considered this thread, but it did not help.

    https://www.accessforums.net/access/...ime-45396.html

  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
    What is purpose of the timestamp fields? Why do you want to document the date the price changed? How does this factor into using the price data? How will you know which price to use for orders?

    You will need to use code to automatically revise the date value when the price changes. Try the BeforeUpdate event of a control (like a combobox) on a form.
    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
    azhar2006's Avatar
    azhar2006 is offline Expert
    Windows 7 32bit Access 2007
    Join Date
    Mar 2012
    Posts
    528
    How do I do this step (June)
    Is there an example of this?
    use code to automatically revise the date value when the price changes. Try the BeforeUpdate event of a control (like a combobox) on a form.

  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
    Many, many examples. Saving calculated data is a common topic.

    Me!fieldname = Me.textboxname

    or

    Me!fieldname = Now()

    or

    Me.textboxname = Now()

    or

    Me!fieldname = Date()

    or

    Me.textboxname = Date()
    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.

  5. #5
    azhar2006's Avatar
    azhar2006 is offline Expert
    Windows 7 32bit Access 2007
    Join Date
    Mar 2012
    Posts
    528
    I mean, I have an old price for a product and after several months of this price change when I change the price of the new I do not want to become an update to the old prices fields. Begins the new price of the current day
    How this

  6. #6
    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
    If you don't want price changes to impact existing data records, options:

    1. save the price into data record

    2. create a new record in products table, save the ID of Product records into data records
    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.

  7. #7
    gaker10 is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2014
    Posts
    262
    The purpose of the timestamp fields is the unit price will be different depending on the quantity. Unit prices expire after 30, 60, or 90 days. I want to keep track of these to insert into quotes if the prices are still relevant. When the price is updated, the timer starts over and the price is relevant for another 30, 60, or 90 days. I have a form to keep track of which prices go where.

  8. #8
    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
    Did you attempt code by the examples in post 4 in an event as described in post 2?

    Is the info in post 6 relevant to your situation?
    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.

  9. #9
    gaker10 is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2014
    Posts
    262
    I will give it a try. Do I put the code in the form events or table events? My database is currently split (Front end and back end). Back end is all tables, front end is forms. With 2 exceptions, every table has a form.

  10. #10
    gaker10 is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2014
    Posts
    262
    I think I got it to work

    Is there a way to format the date field based on time passed? Like change the date's font color to red if it is past 30 days or something?

  11. #11
    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
    Use Conditional Formatting.

    [DateA] + 30 >= Date()
    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.

  12. #12
    gaker10 is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2014
    Posts
    262
    Where does this go for a table? And where do I actually tell it which format to use?

  13. #13
    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
    Cannot do this by any method in table or query, only on forms and reports.

    Conditional Formatting is a utility available on ribbon. Form in design view, select textbox and set conditions as desired. The expression I show would be a condition. Access Help has more info on using Conditional Formatting.
    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.

  14. #14
    gaker10 is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2014
    Posts
    262
    Got it to work on my form and color coded it per 30 day intervals Thank you!

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

Similar Threads

  1. TimeStamp Issues
    By mike760534211 in forum Access
    Replies: 3
    Last Post: 01-08-2014, 04:51 PM
  2. Insert A TimeStamp
    By dandoescode in forum Forms
    Replies: 3
    Last Post: 06-25-2012, 12:34 PM
  3. Passthrough over a timestamp?
    By KrisDdb in forum Access
    Replies: 1
    Last Post: 01-10-2012, 06:42 PM
  4. Add timestamp after text entry
    By JeffG3209 in forum Programming
    Replies: 4
    Last Post: 06-29-2011, 10:21 PM
  5. Access Timestamp...
    By HMel in forum Access
    Replies: 4
    Last Post: 08-19-2008, 01:30 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