Solved Position the cursor at the end of the textbox (1 Viewer)

zelarra821

Registered User.
Local time
Today, 15:20
Joined
Jan 14, 2019
Messages
803
Good afternoon.

I'm trying to get my cursor at the end in a textbox after updating it, but I can't. I have recorded a short video that supports my words and you can see the behavior.

Video

This is the code I have after updating:

Code:
Private Sub Leido1_AfterUpdate()
'    If IsNull(Me.Leido1) Then
'        Me.Leido1 = 0
'    End If
    DoCmd.Requery
'    CargarValores Me
End Sub

The problem is in the DoCmd.Requery, which I use to update the form and the calculated values that you see throughout the form. The rest of the code that you see commented does not affect the problem, that's why I have it like this.

If I put a breakpoint in VBA it just goes through that DoCmd.Requery, for nothing else.

If I try to force it, for example, like this:

Code:
Me.Leido1.SelStart = Len(Me.Leido1) + 1

continues to be at the beginning.

How can i fix it?

Thanks.
 

Gasman

Enthusiastic Amateur
Local time
Today, 14:20
Joined
Sep 21, 2011
Messages
14,043
Your control is numeric and likely right justified, so the selstart will be to the left not right.?
If it was a string, then you would get the cursor to the right?
 

zelarra821

Registered User.
Local time
Today, 15:20
Joined
Jan 14, 2019
Messages
803
The control is indeed numeric, but it is centered, not right-aligned. Here you can see it more clearly:

ScreenShot001.jpg


In addition, you are right that if it were a string, place the cursor to the right, even being centered, as you can see in the image.

So how do you fix this?
 

zelarra821

Registered User.
Local time
Today, 15:20
Joined
Jan 14, 2019
Messages
803
By the way, the alignment that I give to the field in the table is general.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 07:20
Joined
Oct 29, 2018
Messages
21,357
Hi. Just curious, what do you get if you use SelStart=0?
 

Gasman

Enthusiastic Amateur
Local time
Today, 14:20
Joined
Sep 21, 2011
Messages
14,043
I just tried it on a numeric control and the selstart is to the left.?
 

Gasman

Enthusiastic Amateur
Local time
Today, 14:20
Joined
Sep 21, 2011
Messages
14,043
So it is doing exactly what I said it would do?
I do not see the SelStart = 0 being used.?
 

zelarra821

Registered User.
Local time
Today, 15:20
Joined
Jan 14, 2019
Messages
803
So it is doing exactly what I said it would do?
That's right, if it is numeric, it places it on the left, as you say.
I do not see the SelStart = 0 being used.?
Take a good look at the video because I do use it.

I have made another change in menu> File / Options / Client configuration / Behavior when entering the field -> "Go to the end of the field", but it does not solve it either.
 

zelarra821

Registered User.
Local time
Today, 15:20
Joined
Jan 14, 2019
Messages
803
I have already found the solution.

I have to change the reading order in the properties of the text box from "Context", to "Right to Left".

Thanks a lot!
 

theDBguy

I’m here to help
Staff member
Local time
Today, 07:20
Joined
Oct 29, 2018
Messages
21,357
I have already found the solution.

I have to change the reading order in the properties of the text box from "Context", to "Right to Left".

Thanks a lot!
Hi. Glad to hear you got it sorted out. Good luck with your project.
 

Users who are viewing this thread

Top Bottom