datstamp, timestamp user stamp in memo box entry

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

Guest

Hi there, I wanted to be able to have a button that automaticallygoes to the
ned of the notes starts a new line and enters some thing like Date Time User :

is there a way of doing this with maybe a button? i know its better to use a
tabnular system but im going to need it done like this... can anyone help???

thanks in advance,

Will
 
Not really sure what a "tabnular system" is, but I've used this code for
quite some time:

Private Sub DateStampMemoField_Click()
If IsNull(YourMemoBox.Value) Then
YourMemoBox.SetFocus
Me.YourMemoBox.Value = Now() & ": "
Me.YourMemoBox.SelStart = Len(YourMemoBox)
Else
YourMemoBox.SetFocus
Me.YourMemoBox = Me.YourMemoBox.Value & vbNewLine & Now() & ": "
Me.YourMemoBox.SelStart = Len(YourMemoBox)
End If
End Sub


bilbo+ said:
Hi there, I wanted to be able to have a button that automaticallygoes to the
ned of the notes starts a new line and enters some thing like Date Time User :

is there a way of doing this with maybe a button? i know its better to use a
tabnular system but im going to need it done like this... can anyone help???

thanks in advance,

Will

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000

Message posted via AccessMonster.com
 
Sorry, didn't notice the "User" part. Maybe a slight modification:

Private Sub DateStampMemoField_Click()
If IsNull(YourMemoBox.Value) Then
YourMemoBox.SetFocus
Me.YourMemoBox.Value = Now() & " " & CurrentUser() & ": "
Me.YourMemoBox.SelStart = Len(YourMemoBox)

Else
YourMemoBox.SetFocus
Me.YourMemoBox = Me.YourMemoBox.Value & vbNewLine &Now() & " " &
CurrentUser() & ": "
Me.YourMemoBox.SelStart = Len(YourMemoBox)
End If
End Sub

If this doesn't give you the user info you want come back and we'll figure it
out for you. The Data/Time part, as I said, has been working for me for a
number of years!

Good Luck!
 
Hi there, I wanted to be able to have a button that automaticallygoes to the
ned of the notes starts a new line and enters some thing like Date Time User :

If you're storing *multiple fields* (date, time, user, comment) and *multiple
comments* in a single Memo field... you're making your job much more
difficult. These will be all but impossible to search; you won't be able to
pull out all comments made in May; the memo field is at much higher risk of
corruption.

Instead, I'd really recommend having a separate Notes table related
one-to-many to your main table. It should have a timestamp field CommentTime,
with a default value of Now(); a CommentBy field which you set to CurrentUser
in the form's BeforeInsert event; and a field for the comment. You'ld have a
simple continuous subform on the main form, with only the comment field
enabled so you can see who and when but cannot edit those fields.

John W. Vinson [MVP]
 
You're exactly right, John, for all the reasons stated, if Bilbo+ has *any*
intention of *ever* doing any kind of data manipulation on this field! On
top of the reasons you sighted, there's always the "truncation by query"
problems! I work in healthcare informatics, and have successfully used memo
fields for years. My secret is that I use them as they were intended to be
used; to keep a running record of "memos" or notes as we call them in
healthcare. Any data that could possibly need to be accessed or manipulated
programatically goes into regular textboxes. It's all a matter, as my
grandfather used to say, of "using the right tool for the right job!"
 
Back
Top