Cursor Placement

G

Guest

Hello all,

Is there a way (using VB) to force the cursor to move to the end of text
when a field has the focus.

I have the following code which puts the cursor at the start of the field,
but I want to cursor to be at the end of the field:

Private Sub FirstName_GotFocus()
Me!FirstName.SelStart = Me!FirstName.SelLength
End Sub

There does not appear to be a reverse action for SelStart in VB Help which
seems odd.
 
F

fredg

Hello all,

Is there a way (using VB) to force the cursor to move to the end of text
when a field has the focus.

I have the following code which puts the cursor at the start of the field,
but I want to cursor to be at the end of the field:

Private Sub FirstName_GotFocus()
Me!FirstName.SelStart = Me!FirstName.SelLength
End Sub

There does not appear to be a reverse action for SelStart in VB Help which
seems odd.

Me!FirstName.SelStart = Len(Me![FirstName])
 
G

Guest

Fredg,

Wow that was really fast on the draw. Thanks a million :)

fredg said:
Hello all,

Is there a way (using VB) to force the cursor to move to the end of text
when a field has the focus.

I have the following code which puts the cursor at the start of the field,
but I want to cursor to be at the end of the field:

Private Sub FirstName_GotFocus()
Me!FirstName.SelStart = Me!FirstName.SelLength
End Sub

There does not appear to be a reverse action for SelStart in VB Help which
seems odd.

Me!FirstName.SelStart = Len(Me![FirstName])
 

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