How to create a Date/Time Stamp in a memo field (1 Viewer)

pcdummy

Registered User.
Local time
Today, 09:21
Joined
May 9, 2001
Messages
45
I have an application that I would like to be able to create a commannd button on the form which would pouluate a memo field box with the current date and time. However, it must not disturb any of text that is already there. I am using this to keep a record of notes taken when speaking to a particular client. Anyone have any ideas???
Been looking forever.


Thanks
Jeff
 

Jack Cowley

Registered User.
Local time
Today, 09:21
Joined
Aug 7, 2000
Messages
2,639
If your memo field is called Memofield then this code in the On Click event of a command button should do what you want. Obviously change the name below to the actual name of your field...

Me.MemoField = Me.MemoField & Now()
 

R. Hicks

AWF VIP
Local time
Today, 03:21
Joined
Dec 23, 1999
Messages
619
Jack's code will work, but I'd add a space just to make it look right.

Me.MemoField = Me.MemoField & " " & Now()

Gotcha Jack,
RDH
 

pcdummy

Registered User.
Local time
Today, 09:21
Joined
May 9, 2001
Messages
45
Thanks guys worked beautifully. Love this site!!!! Will be here everyday from now on. Hope I can learn enough to help others as well.

My Sincerest Thanks

Jeff
 

KevinM

Registered User.
Local time
Today, 09:21
Joined
Jun 15, 2000
Messages
719
I think you'll find it better if you store this date in a separate field (Date type), rather than tagged on the end of the memo text. You will then be able to use the numerous Date functions that Access offers.

You will also run into problems when you
want to search, sort etc on this date.
 

Maestro

Registered User.
Local time
Today, 09:21
Joined
Jun 16, 2001
Messages
21
In a database I'm creating I want a field that shows the date and time a function was last used (in this case a backup being made). I've used this line of code in the On Click event of the command button and it updates an unbound field on my form called 'pubdate'. Only two problems:

- On pressing the button a second time the new date and time is just added on to the end of the first, I need the original to be cleared.
- On closing and re-opening the database, the date stamp has been lost altogether.

Is there a line I could add to clear the first date stamp before the updated one appears? Is there any way I can retain the information in that unbound field? There's no use adding this to a table because it applies to the whole database rather than individual records.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 04:21
Joined
Feb 19, 2002
Messages
43,484
Forms don't store data. Tables store data. If you want to keep track of the last time something happened, create a table to hold the info and a bound form to update it.
 

Users who are viewing this thread

Top Bottom