Time Stamp

  • Thread starter Thread starter Beer Wolf
  • Start date Start date
B

Beer Wolf

Hello,

We would like our data entry form to have a time stamp
field that will obviously automatically update the exact
time the person submits the form.

This is simple in FrontPage, but I am unsure how to do
that in Access. We are running version 2002, by the way.

Thanks
 
Put code into the form's BeforeUpdate event to set the timestamp field's
value to Now.
 
Can you please elaborate?

Thank

-----Original Message-----
Put code into the form's BeforeUpdate event to set the timestamp field's
value to Now.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)






.
 
Private Sub Form_BeforeUpdate (Cancel as Integer)
With Forms![name of form]![name of field]
If Nz(.value) <> Nz(.oldvalue) then
me.[name of datefield] = now()
End if
End with
End Sub


"Name of field is any field they update before they close
the form."
 
Okay, I tried that, but it gave me this message - Compile
error: Syntax error.

Here is the code I entered:
Private Sub Form_BeforeUpdate(Cancel As Integer)
With Forms![Employees]![EmployeeName]
If Nz.(Value) <> (.oldvalue) then
Me.[TimeStamp] = Now()

End If
End With
End Sub

My table is Employees, one of the fields is EmployeeName
and the field TimeStamp is the one where we want the date
automatically entered.
Thanks


-----Original Message-----



Private Sub Form_BeforeUpdate (Cancel as Integer)
With Forms![name of form]![name of field]
If Nz(.value) <> Nz(.oldvalue) then
me.[name of datefield] = now()
End if
End with
End Sub


"Name of field is any field they update before they close
the form."
-----Original Message-----
Can you please elaborate?

Thank

wrote
in message
.
.
 
Whoops, I meant my form is named Employees.
Thanks

-----Original Message-----
Okay, I tried that, but it gave me this message - Compile
error: Syntax error.

Here is the code I entered:
Private Sub Form_BeforeUpdate(Cancel As Integer)
With Forms![Employees]![EmployeeName]
If Nz.(Value) <> (.oldvalue) then
Me.[TimeStamp] = Now()

End If
End With
End Sub

My table is Employees, one of the fields is EmployeeName
and the field TimeStamp is the one where we want the date
automatically entered.
Thanks


-----Original Message-----



Private Sub Form_BeforeUpdate (Cancel as Integer)
With Forms![name of form]![name of field]
If Nz(.value) <> Nz(.oldvalue) then
me.[name of datefield] = now()
End if
End with
End Sub


"Name of field is any field they update before they close
the form."
-----Original Message-----
Can you please elaborate?

Thank


-----Original Message-----
Put code into the form's BeforeUpdate event to set the
timestamp field's
value to Now.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



in message
Hello,

We would like our data entry form to have a time stamp
field that will obviously automatically update the
exact
time the person submits the form.

This is simple in FrontPage, but I am unsure how to do
that in Access. We are running version 2002, by the
way.

Thanks


.

.
.
.
 
That should be

If Nz(.Value) <> (.oldvalue) then

(you've got the period in the wrong place)

However, recognize that that will only change the timestamp if the
EmployeeName is changed, but not if any other fields associated with the
Employee are changed.

If you want to change the timestamp regardless of what's actually been
changed, try:

Private Sub Form_BeforeUpdate(Cancel As Integer)
Me.[TimeStamp] = Now()
End Sub


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



Beer Wolf said:
Whoops, I meant my form is named Employees.
Thanks

-----Original Message-----
Okay, I tried that, but it gave me this message - Compile
error: Syntax error.

Here is the code I entered:
Private Sub Form_BeforeUpdate(Cancel As Integer)
With Forms![Employees]![EmployeeName]
If Nz.(Value) <> (.oldvalue) then
Me.[TimeStamp] = Now()

End If
End With
End Sub

My table is Employees, one of the fields is EmployeeName
and the field TimeStamp is the one where we want the date
automatically entered.
Thanks


-----Original Message-----



Private Sub Form_BeforeUpdate (Cancel as Integer)
With Forms![name of form]![name of field]
If Nz(.value) <> Nz(.oldvalue) then
me.[name of datefield] = now()
End if
End with
End Sub


"Name of field is any field they update before they close
the form."

-----Original Message-----
Can you please elaborate?

Thank


-----Original Message-----
Put code into the form's BeforeUpdate event to set the
timestamp field's
value to Now.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



in message
Hello,

We would like our data entry form to have a time stamp
field that will obviously automatically update the
exact
time the person submits the form.

This is simple in FrontPage, but I am unsure how to do
that in Access. We are running version 2002, by the
way.

Thanks


.

.

.
.
 
Hey now! That worked perfect.

Thanks much for the help!!

-----Original Message-----
That should be

If Nz(.Value) <> (.oldvalue) then

(you've got the period in the wrong place)

However, recognize that that will only change the timestamp if the
EmployeeName is changed, but not if any other fields associated with the
Employee are changed.

If you want to change the timestamp regardless of what's actually been
changed, try:

Private Sub Form_BeforeUpdate(Cancel As Integer)
Me.[TimeStamp] = Now()
End Sub


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



Whoops, I meant my form is named Employees.
Thanks

-----Original Message-----
Okay, I tried that, but it gave me this message - Compile
error: Syntax error.

Here is the code I entered:
Private Sub Form_BeforeUpdate(Cancel As Integer)
With Forms![Employees]![EmployeeName]
If Nz.(Value) <> (.oldvalue) then
Me.[TimeStamp] = Now()

End If
End With
End Sub

My table is Employees, one of the fields is EmployeeName
and the field TimeStamp is the one where we want the date
automatically entered.
Thanks



-----Original Message-----



Private Sub Form_BeforeUpdate (Cancel as Integer)
With Forms![name of form]![name of field]
If Nz(.value) <> Nz(.oldvalue) then
me.[name of datefield] = now()
End if
End with
End Sub


"Name of field is any field they update before they
close
the form."

-----Original Message-----
Can you please elaborate?

Thank


-----Original Message-----
Put code into the form's BeforeUpdate event to set the
timestamp field's
value to Now.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



"Beer Wolf" <[email protected]>
wrote
in message
Hello,

We would like our data entry form to have a time
stamp
field that will obviously automatically update the
exact
time the person submits the form.

This is simple in FrontPage, but I am unsure how to
do
that in Access. We are running version 2002, by the
way.

Thanks


.

.

.

.


.
 
Back
Top