Date & Time stamp in form

amunoz94

New member
Local time
Today, 11:51
Joined
Jan 24, 2013
Messages
8
Hi,

I have search and have not found what I need. I have an expense trip database that when you login it opens a "expense report list" form and on that form I have a button that opens a new pop up entry data form that you enter data that inputs it into the expense report list form. What I want to do is have a date time stamp on popup entry data form and I need it to stamp a date & time on the form and I need for the date and time to be permanent until form is updated and changed.

I have used the date and time feature in the design view. it added two boxes on top right in the header as =time() and =date(). I did a test and added test data, saved it and closed the form. When I went back and opened form from the record ID, it shows new time stamp and not the time it was created. Do I need to add something in the before update or after update in the events tab? Do I need to have an entry in the main table to show date & time?
 
John thanks, I tried this function, but when i reopen the form it does not keep the original time stamp when data was entered into form. I need this when data needs to be checked on when it was entered into the form. If data was entered lets say yesterday at 10:00 am and three days later form is opened, I need it to show that date at 10:00 am. So how do I accomplish this on my form?
 
How are you applying the Date/Time stamp? If it is getting over written when the form is re-opened, it would tend to suggest you are not using the right event to apply your Date/Time stamp.
 
currently in the event tab, after update - event procedure

Code:
Private sub text68_afterupdate()
Date = now()
end sub

is this the problem? should it be just =date() and =time() or should it read just =now()?
 
Try;
Code:
Private sub text68_afterupdate()

If IsNull(Date) then
     Date = Now()
EndIf

end sub

I would also suggest that you not use a field name like Date as this is an Access Reserved Word, and has the potential to cause you no end of grief, if it is not already doing so.
 

Users who are viewing this thread

Back
Top Bottom