date stamp Can I add a date stamp in a Text or Memo Field

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Can I add a date stamp (and or a User stamp) in a Text or Memo Field when a
user updates my notes field (Memo)
 
If you are asking, "can I concatenate the value of the current date and time
into a text field's contents" (or memo field's contents), the answer is yes.
 
Can you point me in the dircection of any examples or code that could help
me. Thanks,
 
In which context would you be doing this?

As an example, the following code step would add the current date and time
to a control on a form:

Me.ControlName.Value = Me.ControlName.Value & vbCrLf & _
Format(Now(), "dd mmm yyyy at hh:nn:ss ampm")
 
Note that the vbCrLf that I put in the code is not a requirement - I
included it only as a "separator" for the date/time stamp. Also, the Format
"format" ("dd mmm yyyy at hh:nn:ss ampm") that I provided can be changed to
other options.
 
On Mon, 4 Apr 2005 16:13:01 -0700, Michael L <Michael
Can I add a date stamp (and or a User stamp) in a Text or Memo Field when a
user updates my notes field (Memo)

As Ken says - you can; but you *shouldn't*. Fields should be atomic. A
text note and a timestamp are two different pieces of information!

Might you consider adding a Date/Time field (default value Now()) to
your table, so that when a record (including a note) is entered the
time that it was entered is automatically retained, just in a
different field?

John W. Vinson[MVP]
 
The Date/Time field with the Now() default works great for indicating when a
record is entered. But how would you implement a "Date Last Changed"
Date/Time field that would change to Now() whenever anything in the record is
changed? I suspect it might be based on the BeforeUpdate event but I can't
find anything on the actual mechanics of it.
 
The Date/Time field with the Now() default works great for indicating when a
record is entered. But how would you implement a "Date Last Changed"
Date/Time field that would change to Now() whenever anything in the record is
changed? I suspect it might be based on the BeforeUpdate event but I can't
find anything on the actual mechanics of it.

Quite correct. Something like this in the Form's BeforeUpdate:

Private Sub Form_BeforeUpdate(Cancel as Integer)
<put any validation code here, set Cancel to True and exit if there is
a validation error>
<if all is well...>
Me!DateLastChanged = Now
End Sub

John W. Vinson[MVP]
 
That worked fine. Thank you.

But suppose I go in and change something directly in a table without using a
form. Is there any way to ensure that the "Date Last Changed" field gets
updated then too?
 
mdavidjohnson said:
That worked fine. Thank you.

But suppose I go in and change something directly in a table without
using a form. Is there any way to ensure that the "Date Last Changed"
field gets updated then too?

Nope. Not unless you use a server database that supports triggers for the back
end.
 
But suppose I go in and change something directly in a table without using a
form. Is there any way to ensure that the "Date Last Changed" field gets
updated then too?

No.

John W. Vinson[MVP]
 
Back
Top