8 minutes ago: Please note that the webserver will soon get its weekly reboot at 4:00 am Eastern Time. You may continue to use the site as normal, but you will be logged off at that time. You should be able to log right back on immediately, however. If you are in the process of placing an order, please make sure to complete it as quickly as possible, or come back after the reboot. Thank you. Sorry for any inconvenience.  Dismiss
 
Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Date last edited
A Castro 
    
12 years ago
I'm trying to place a "last modified" field on a form that records the last time a record was edited.


I've dug around online and have come up with some solutions. Most recommend that code be placed on the "Before Update" event procedure.

Microsoft recommended the following:

Private Sub Form_BeforeUpdate(Cancel As Integer)
    On Error GoTo BeforeUpdate_Err

    ' Set bound controls to system date and time.
    DateModified = Date
    TimeModified = Time()

BeforeUpdate_End:
    Exit Sub
BeforeUpdate_Err:
    MsgBox Err.Description, vbCritical & vbOKOnly, _
        "Error Number " & Err.Number & " Occurred"
    Resume BeforeUpdate_End
End Sub


However, when I go that route, the code only places a date when i create a record. Nothing happens every time I make an edit.

I tried placing the code on the "after Update" event procedure. That seems to work, but the record locks and I am unable to scroll to the next record.
This is the code:

Private Sub Form_AfterUpdate()
Me![DateModified] = Now()
End Sub

What gives?
Thanks


Reply from Richard Rost:

Unfortunately, due to the way Access events work, you'll need to place an AfterUpdate event in EACH FIELD of the form to update your DateModified field.

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Forum.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 5/17/2026 3:38:12 AM. PLT: 1s