TxtBox with Timestamp on each change

M

melbourno

How can I add timestamp =now() in a new line whenever someone make
changes in Detail Descriptions box?
 
S

Stuart McCall

How can I add timestamp =now() in a new line whenever someone make
changes in Detail Descriptions box?

If your box is called txtDesc, then:

txtDesc = txtDesc & vbCrLf & Now

in txtDesc's AfterUpdate event ought to do it.
 
M

melbourno

Thank you for your help.....I tried to enter the below code

Private Sub Detailed_Description_AfterUpdate()
Detailed Description = Detailed Description & vbCrLf & Now
End Sub

It just didn't work. Could you help with it please?
 
D

Damon Heron

Make sure you have the name of the textbox the same thruout your code:

me.Detailed_Description = me.Detailed_Description & vbCrLf & Now
 
M

melbourno

Thank you so much for your help...

Private Sub Detailed_Description_AfterUpdate()
Me.Detailed_Description = Now & vbCrLf & Me.Detailed_Description
End Sub

I would like it to timestamp it as showing below in lines:
2/17/2009 3:36:51 PM, Test1
2/17/2009 3:37:05 PM, Test2
2/17/2009 3:39:26 PM, Test3
2/17/2009 3:49:40 PM, Test4

Could it be possible to do it?

Please help in here
 
J

John W. Vinson

Thank you so much for your help...

Private Sub Detailed_Description_AfterUpdate()
Me.Detailed_Description = Now & vbCrLf & Me.Detailed_Description
End Sub

I would like it to timestamp it as showing below in lines:
2/17/2009 3:36:51 PM, Test1
2/17/2009 3:37:05 PM, Test2
2/17/2009 3:39:26 PM, Test3
2/17/2009 3:49:40 PM, Test4

Could it be possible to do it?

Please help in here

Are you trying to store multiple descriptions in a single field (presumably a
memo field)? If so, you're probably Making A Mistake. What you would need to
do - to get the records in ascending order - is reverse the sequence:

Me.Detailed_Description = Me.Detailed_Description & vbCrLf & Now & Me.<some
other form control containing the Test4 or other text>

However, storing multiple "records" in a single field makes it impossible to
effectively search. You should consider instead having a second table related
one-to-many to your main table, with fields for the linking field, a time
stamp (default value Now()), and a text or memo field for the individual
descriptions.
 
D

Damon Heron

If I understand, you want the time/date then a comma and then the text,
correct?
If so --
Me.Detailed_Description = Now & ", " & me.detailed_description & vbCrLf

will do that. vbCrLf is a "carriage return" and Line feed.

You will see that this is really annoying. I think what you are after is a
record of changes by the user
to be recorded in your table??? If so, I would add a field to your table as
date/time and in the after update of your form, update the field with now.
The simplest way would be to add a textbox bound to your new date/time
field,
make it invisible, and in the afterupdate event,
me.hiddenttxtbox = now
If you want to save, instead, the former contents of the textbox before
editing, that gets a bit more complex,
and you probably will want to explore audit tracking.
Allen Browne has a sample at his site--
Creating an Audit Log
http://www.allenbrowne.com/AppAudit.html

Damon
 

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

Similar Threads


Top