display date then new line

G

Guest

Hello
I have a form containing a number of fields. When the user clicks in a field
I would like it to display the current date, then position the cursor at the
start of the next line ready for the user to start typing. I can display
the date, but I cant get the cursor to go to the next line. Code is as
follows:

Private Sub Text0_Enter()

Me.Text0 = Left(Now(), 8) & vbCrLf

Me.Text0.SelStart = Len(Me.Text0) - 2

End Sub

This displays the date with the cursor at the end. If I omit the '-2' in
the selstart line, the date is obliterated and the cursor is set at the start
of the field.
Any help would be much appreciated as always.
 
R

ruralguy via AccessMonster.com

Are you sure it is a the beginning of the field or is it at the beginning of
the 2nd line? Do you now have a verticle scrill bar? Make the TextBox
taller as a test and see what is happening.
 
D

Damon Heron

Private Sub Text0_Enter()
Me.Text0 = Left(Now(), 9)
Me.Text0.SelStart = Len(Me.Text0) - 0
SendKeys "^~"
End Sub

Damon
 

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