Position of Cursor in field

G

Guest

I have one text box on my form where I would like the cursor to go to the end
of the data in the field so I can enter more data. All the other text boxes
I would like to have the cursor enter so I can replace any the data already
in the field

I don't know how to do that

Any help would be appreciated
 
A

Allen Browne

1. Set the On Enter property of the text box to:
[Event Procedure]

2. Click the Build button (...) beside this.
Access opens the code window.

3. Set up the code so it looks like this, replacing Notes with the name of
your field:

Private Sub Notes_Enter()
With Me.[Notes]
If Not IsNull(.Value) Then
.SelStart = Len(.Value)
End If
End With
End Sub
 
M

missinglinq via AccessMonster.com

Here you go, Frank!

'This sets cursor at the end of current text
Private Sub YourTextBox_Enter()
Me.YourTextBox.SelStart = Len(YourTextBox.Value)
End Sub

'This sets cursor at the beginning of current text
Private Sub YourTextBox_Enter()
Me.YourTextBox.SelStart = 0
End Sub

'This selects (hi-lites) all of the current text
Private Sub YourTextBox_Enter()
Me.YourTextBox.SelStart = 0
Me.YourTextBox.SelLength = Len(YourTextBox.Value)
End Sub



Allen said:
In the Enter event of the text box, set SelStart to SelLength.
I have one text box on my form where I would like the cursor to go to the
end
[quoted text clipped - 7 lines]
Any help would be appreciated

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

Answers/posts based on Access 2000

Message posted via AccessMonster.com
 

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