PC Review


Reply
Thread Tools Rate Thread

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

 
 
=?Utf-8?B?TWljaGFlbCBM?=
Guest
Posts: n/a
 
      5th Apr 2005
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)
 
Reply With Quote
 
 
 
 
Ken Snell [MVP]
Guest
Posts: n/a
 
      5th Apr 2005
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.

--

Ken Snell
<MS ACCESS MVP>

"Michael L" <Michael (E-Mail Removed)> wrote in message
news:678C3394-E594-45A7-A489-(E-Mail Removed)...
> 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)



 
Reply With Quote
 
=?Utf-8?B?TWljaGFlbCBM?=
Guest
Posts: n/a
 
      5th Apr 2005
Can you point me in the dircection of any examples or code that could help
me. Thanks,

"Ken Snell [MVP]" wrote:

> 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.
>
> --
>
> Ken Snell
> <MS ACCESS MVP>
>
> "Michael L" <Michael (E-Mail Removed)> wrote in message
> news:678C3394-E594-45A7-A489-(E-Mail Removed)...
> > 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)

>
>
>

 
Reply With Quote
 
Ken Snell [MVP]
Guest
Posts: n/a
 
      5th Apr 2005
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")

--

Ken Snell
<MS ACCESS MVP>

"Michael L" <(E-Mail Removed)> wrote in message
news:C39D5763-B932-486F-AE5C-(E-Mail Removed)...
> Can you point me in the dircection of any examples or code that could
> help
> me. Thanks,
>
> "Ken Snell [MVP]" wrote:
>
>> 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.
>>
>> --
>>
>> Ken Snell
>> <MS ACCESS MVP>
>>
>> "Michael L" <Michael (E-Mail Removed)> wrote in message
>> news:678C3394-E594-45A7-A489-(E-Mail Removed)...
>> > 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)

>>
>>
>>



 
Reply With Quote
 
Ken Snell [MVP]
Guest
Posts: n/a
 
      5th Apr 2005
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.
--

Ken Snell
<MS ACCESS MVP>

"Ken Snell [MVP]" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> 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")
>
> --
>
> Ken Snell
> <MS ACCESS MVP>
>
> "Michael L" <(E-Mail Removed)> wrote in message
> news:C39D5763-B932-486F-AE5C-(E-Mail Removed)...
>> Can you point me in the dircection of any examples or code that could
>> help
>> me. Thanks,
>>
>> "Ken Snell [MVP]" wrote:
>>
>>> 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.
>>>
>>> --
>>>
>>> Ken Snell
>>> <MS ACCESS MVP>
>>>
>>> "Michael L" <Michael (E-Mail Removed)> wrote in message
>>> news:678C3394-E594-45A7-A489-(E-Mail Removed)...
>>> > 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)
>>>
>>>
>>>

>
>



 
Reply With Quote
 
John Vinson
Guest
Posts: n/a
 
      5th Apr 2005
On Mon, 4 Apr 2005 16:13:01 -0700, Michael L <Michael
(E-Mail Removed)> wrote:

>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]
 
Reply With Quote
 
=?Utf-8?B?bWRhdmlkam9obnNvbg==?=
Guest
Posts: n/a
 
      8th Apr 2005
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.

"John Vinson" wrote:

> On Mon, 4 Apr 2005 16:13:01 -0700, Michael L <Michael
> (E-Mail Removed)> wrote:
>
> >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]
>

 
Reply With Quote
 
John Vinson
Guest
Posts: n/a
 
      9th Apr 2005
On Fri, 8 Apr 2005 13:51:02 -0700, "mdavidjohnson"
<(E-Mail Removed)> wrote:

>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]
 
Reply With Quote
 
=?Utf-8?B?bWRhdmlkam9obnNvbg==?=
Guest
Posts: n/a
 
      11th Apr 2005
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?

"John Vinson" wrote:

> On Fri, 8 Apr 2005 13:51:02 -0700, "mdavidjohnson"
> <(E-Mail Removed)> wrote:
>
> >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]
>

 
Reply With Quote
 
Rick Brandt
Guest
Posts: n/a
 
      11th Apr 2005
mdavidjohnson wrote:
> 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.

--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Date/Time stamp in Memo Field Peter Microsoft Access Form Coding 4 22nd Dec 2009 08:58 PM
Date stamp an entry in a memo field Dave Eliot Microsoft Access 2 16th Oct 2009 05:30 PM
Date stamp in Memo field - without SendKeys =?Utf-8?B?cHJpY2V5OTk=?= Microsoft Access 2 18th Jun 2007 05:07 PM
need date/time stamp on each line in memo field =?Utf-8?B?RmF0Ym95bWVkaWM=?= Microsoft Access 7 10th Jun 2006 01:59 AM
date time stamp a memo field david Microsoft Access Form Coding 2 16th Sep 2003 04:58 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:43 AM.