Apply a date and blank lines automatically to the top of a memo fi

G

Guest

I have a memo field on a form in which users will always add new info on top
of existing data/notes. Upon entering the field (either by tabbing or
clicking), they would like to:

1. insert the current date automatically at the beginning of the existing
field contents (without overwriting what's already there)
2. insert a couple of blank lines (vbCR?)
3. move cursor to the top of the field contents and to the right of the
date, so they can start typing their latest comments.

Is this possible? If so, what recommendations can you give me? Which field
event would I use; On Enter, On Got Focus or something else?
 
M

Marshall Barton

Mona-ABE said:
I have a memo field on a form in which users will always add new info on top
of existing data/notes. Upon entering the field (either by tabbing or
clicking), they would like to:

1. insert the current date automatically at the beginning of the existing
field contents (without overwriting what's already there)
2. insert a couple of blank lines (vbCR?)
3. move cursor to the top of the field contents and to the right of the
date, so they can start typing their latest comments.

Is this possible? If so, what recommendations can you give me? Which field
event would I use; On Enter, On Got Focus or something else?


Play around with this kind of idea:

Sub textbox_GotFocus()
Me.textbox = Format(Date, "d mmm, yyyy") & vbCrLf _
& vbCrLf & Me.textbox
Me.SelStart = 12 'length of date string
End Sub

But, I think I would not allow the user to tab or click into
the textbox. If they can then you will get many entries
with just the same date. Perhaps you should have a separate
button to enable the textbox and set the focus to it???
 
G

Guest

I see your point. I'll ask them if they'd like that type of querying
capability on their notes. Thanks for the suggestion.
 

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

Top