timestamp (1 Viewer)

kitty77

Registered User.
Local time
Today, 03:13
Joined
May 27, 2019
Messages
710
Is there a way to have a field that time stamps anytime that record has been added, edited, changed, etc...

Thanks...
 

theDBguy

I’m here to help
Staff member
Local time
Today, 00:13
Joined
Oct 29, 2018
Messages
21,454
I use two DateTime fields for that: Created and Modified. Set the default for Created to Now() and use data macro or VBA to update Modified to Now() when the record is changed/edited.
 

kitty77

Registered User.
Local time
Today, 03:13
Joined
May 27, 2019
Messages
710
Thanks
 

kitty77

Registered User.
Local time
Today, 03:13
Joined
May 27, 2019
Messages
710
I get the created but how would the changed or edited look in vba? Where is the best place to put it on my form?
 

theDBguy

I’m here to help
Staff member
Local time
Today, 00:13
Joined
Oct 29, 2018
Messages
21,454
I get the created but how would the changed or edited look in vba? Where is the best place to put it on my form?
I prefer to use a data macro; but if you like to use VBA, you could place it in the BeforeUpdate event of the Form. For example:
Code:
Me.Modified=Now()
Hope that helps...
 

kitty77

Registered User.
Local time
Today, 03:13
Joined
May 27, 2019
Messages
710
Yes, perfect... One more thing. How can I added who changes, edits, adds, etc...
Basically, which employee did it.
 

Cronk

Registered User.
Local time
Today, 17:13
Joined
Jul 4, 2013
Messages
2,771
To record the logon name of the person on the PC on which the edit was made

Code:
Me.Modified=Now()
Me.UserName = environ("UserName")
 

theDBguy

I’m here to help
Staff member
Local time
Today, 00:13
Joined
Oct 29, 2018
Messages
21,454
Yes, perfect... One more thing. How can I added who changes, edits, adds, etc...
Basically, which employee did it.
Hi. Did you want to know when and who made the latest change only, or do you want to have a history of changes?
 

kitty77

Registered User.
Local time
Today, 03:13
Joined
May 27, 2019
Messages
710
How would a history work and look? Also, the username would come from who every logs into that PC?
Most of the time, we just use one log in, so that would have to change?
 

theDBguy

I’m here to help
Staff member
Local time
Today, 00:13
Joined
Oct 29, 2018
Messages
21,454
How would a history work and look?
I was just wondering what your actual requirements were. If you need to know how the data was progressively changed from the original value, you are probably looking at an audit trail.

Most of the time, we just use one log in, so that would have to change?
Yes, if you want to know the actual person making the change, then you'll have to have a way to identify them.
 

kitty77

Registered User.
Local time
Today, 03:13
Joined
May 27, 2019
Messages
710
Got it. I think I'm just going with this then. I think an audit trail may be a bit much for my needs.

Me.Modified=Now()
Me.UserName = environ("UserName")

Thanks all!
 

theDBguy

I’m here to help
Staff member
Local time
Today, 00:13
Joined
Oct 29, 2018
Messages
21,454
Got it. I think I'm just going with this then. I think an audit trail may be a bit much for my needs.

Me.Modified=Now()
Me.UserName = environ("UserName")

Thanks all!
Sounds like a plan. Good luck with your project.
 

Users who are viewing this thread

Top Bottom