Connecting Tech Pros Worldwide Forums | Help | Site Map

store time and date

Kay
Guest
 
Posts: n/a
#1: Mar 15 '06
I have managed to display the current date and time as a label and
have them updated by the second on my form. Iv got a time and date
field on my form and what I cannot do is record the date and time the
record was first saved.

I have managed to display the current time and date in the date and
time text boxes but they keep on updating while I move through the
records, I want them to just store the time and date when the record
was saved.

Any help will be appreciated


DeanL
Guest
 
Posts: n/a
#2: Mar 15 '06

re: store time and date


Depending on where you store that information (I created a field in a
relevant table), I used the AfterUpdate event to store the current
system date/time in the field as follows:

AfterUpdate

txtBoxForUpdateDate = Now

I've used this to keep track of when the relevant fields/records were
last updated. If you only want the date recorded for the first time a
record is created/saved then some code would be needed to check if the
field value is null before updating. Unfortunately, I'm not 100% up on
that one so maybe someone else could assist in that area.

All the best, Dean...

Bob Quintal
Guest
 
Posts: n/a
#3: Mar 16 '06

re: store time and date


"DeanL" <deanpmlonghurst@yahoo.com> wrote in
news:1142461308.570846.275440@v46g2000cwv.googlegr oups.com:
[color=blue]
> Depending on where you store that information (I created a
> field in a relevant table), I used the AfterUpdate event to
> store the current system date/time in the field as follows:
>
> AfterUpdate
>
> txtBoxForUpdateDate = Now
>
> I've used this to keep track of when the relevant
> fields/records were last updated. If you only want the date
> recorded for the first time a record is created/saved then
> some code would be needed to check if the field value is null
> before updating. Unfortunately, I'm not 100% up on that one
> so maybe someone else could assist in that area.
>
> All the best, Dean...
>
>[/color]
You don't want to use the afterupdate event for this, but the
form's before update. Before occurs just before the entries are
save to the table, the other after. You avoid writing twice with
the before_update. I actually have two fields in the database,
one entitled CreationStamp, the other EditedStamp.

If me.newrecord then
me.creationStamp = now()
else
me.EditedStamp = now()
end if

--
Bob Quintal

PA is y I've altered my email address.
Kay
Guest
 
Posts: n/a
#4: Mar 16 '06

re: store time and date


Thanks alot guys, Have managed to get it to work, just got my reports
and queries left to do and hopefully the project is done. Thanks again

Closed Thread