Modified date time stamp notworking ...Help

G

Guest

I can created a date time when the file is created. But when a user opens
the form again the date time does not change. I have used the following code
in the events before, dirty and afterudpate but no joy..

me[Date_TimeModifeed] = Now()

This should include the time and only stamp the record when some other field
has been modified.


Al
 
A

Al Campagna

Al,
Why would you want the "creation" Date and Time to change just because someone opens
the form? That would mean that it really doesn't represent the Date and Time of Creation,
but only the last time the record was viewed.
Try this method...
Two fields in your table... DOC (DateofCreation) and DOLE (DateOfLastEdit)
In the forms Before Update event, place this code...

Private Sub Form_BeforeUpdate(Cancel As Integer)
If IsNull(DOC) Then
DOC = Now()
Else
DOLE = Now()
End If
End Sub

When a new record is created, DOC gets set (Disable and Lock both fields from user
entry).
Later, when the record is revisited..., AND is "edited" at all, the DOLE will set.

I have a sample file (97 and 2003) on my website below, that demonstrates this (and a
field for records statistics too).
--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."
 
M

missinglinq via AccessMonster.com

Private Sub Form_BeforeUpdate(Cancel As Integer)
Me.Date_TimeModifeed.Value = Now
End Sub


Note: I used your spelling "Date_TimeModifeed" which is incorrect. Doesn't
matter how you spell it, just make sure you spell it the same way everywhere
in your code.
 
M

Marshall Barton

AL said:
I can created a date time when the file is created. But when a user opens
the form again the date time does not change. I have used the following code
in the events before, dirty and afterudpate but no joy..

me[Date_TimeModifeed] = Now()

This should include the time and only stamp the record when some other field
has been modified.


Double check your spelling and syntax. Your retyping above
is not a valid statement.

The Dirty event is appropriate for user mofifications to the
record. It is not effective if you are changing the record
in a VBA procedure.
 
G

Guest

I downloaded you file..works great but on form how do I access the form
properties

Al

Al Campagna said:
Al,
Why would you want the "creation" Date and Time to change just because someone opens
the form? That would mean that it really doesn't represent the Date and Time of Creation,
but only the last time the record was viewed.
Try this method...
Two fields in your table... DOC (DateofCreation) and DOLE (DateOfLastEdit)
In the forms Before Update event, place this code...

Private Sub Form_BeforeUpdate(Cancel As Integer)
If IsNull(DOC) Then
DOC = Now()
Else
DOLE = Now()
End If
End Sub

When a new record is created, DOC gets set (Disable and Lock both fields from user
entry).
Later, when the record is revisited..., AND is "edited" at all, the DOLE will set.

I have a sample file (97 and 2003) on my website below, that demonstrates this (and a
field for records statistics too).
--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."

AL Rios said:
I can created a date time when the file is created. But when a user opens
the form again the date time does not change. I have used the following code
in the events before, dirty and afterudpate but no joy..

me[Date_TimeModifeed] = Now()

This should include the time and only stamp the record when some other field
has been modified.


Al
 
G

Guest

I found the form view...Works Great...I've been at this for 1 month
...everytnight..
I really ...really thank you

AL

AL Rios said:
I downloaded you file..works great but on form how do I access the form
properties

Al

Al Campagna said:
Al,
Why would you want the "creation" Date and Time to change just because someone opens
the form? That would mean that it really doesn't represent the Date and Time of Creation,
but only the last time the record was viewed.
Try this method...
Two fields in your table... DOC (DateofCreation) and DOLE (DateOfLastEdit)
In the forms Before Update event, place this code...

Private Sub Form_BeforeUpdate(Cancel As Integer)
If IsNull(DOC) Then
DOC = Now()
Else
DOLE = Now()
End If
End Sub

When a new record is created, DOC gets set (Disable and Lock both fields from user
entry).
Later, when the record is revisited..., AND is "edited" at all, the DOLE will set.

I have a sample file (97 and 2003) on my website below, that demonstrates this (and a
field for records statistics too).
--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."

AL Rios said:
I can created a date time when the file is created. But when a user opens
the form again the date time does not change. I have used the following code
in the events before, dirty and afterudpate but no joy..

me[Date_TimeModifeed] = Now()

This should include the time and only stamp the record when some other field
has been modified.


Al
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top