I used this method but I think I missed a step or placed something in the
wrong are because when I update some date I get a compile error that it
expected a variable or procedure but not a module. The link said to put
it
into a module so what part am I doing wrong? I've included my code as
well.
Private Sub Form_BeforeUpdate(Cancel As Integer)
Me.[LastUser] = fosUserName()
Me.[LastUpdated] = Now()
Dim strMsg As String
strMsg = "Data has changed."
strMsg = strMsg & "Do you wish to save the changes?"
strMsg = strMsg & " Click Yes to Save or No to Discard changes."
If MsgBox(strMsg, vbQuestion + vbYesNo, "Save Record?") = vbYes Then
'do nothing
Else
DoCmd.RunCommand acCmdUndo
End If
End Sub
Thanks for any help.
Arvin Meyer said:
Get the Windows username as a function an set the value of the lastuser
field to it.:
http://www.mvps.org/access/api/api0008.htm
write the Now() function to the lastupdated timestamp field. You may use
the
BeforeUpdate event to write the values, something like (air code):
Sub Form_BeforeUpdate(Cancel As Integer)
Me.txtLastUser = fOSUserName()
Me.txtLastUpdated = Now()
End Sub
--
Arvin Meyer, MCP, MVP
Microsoft Access
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com
I'm building a tracking database. How do I create a date and time stamp
for
each time some updates my form. I want to includ the name, time and
date
they last updated the form. Is this possible? I've only been using
this
for
about 2 weeks. Can someone help me please.