Add code to Text Box on Access Form
- or -
Post a project like this2345
£15(approx. $19)
- Posted:
- Proposals: 3
- Remote
- #1382836
- Awarded
Description
Experience Level: Intermediate
Estimated project duration: 1 day or less
I have code that places the cursor at the end of a text box on a form. It works fine on one text box but not on another. I need to make it work on both text boxes. The code that works is:
Private Sub Text31_Enter()
Me.Text31.SetFocus
Me.Text31.SelStart = Nz(Len(Me.Text31), 0)
Me.Text31.SelLength = Nz(Len(Me.Text31), 0)
End Sub
The code that doesn't work is:
Private Sub QWG_Enter()
Me.QWG.SetFocus
Me.QWG.SelStart = Nz(Len(Me.QWG), 0)
Me.QWG.SelLength = Nz(Len(Me.QWG), 0)
End Sub
Private Sub Text31_Enter()
Me.Text31.SetFocus
Me.Text31.SelStart = Nz(Len(Me.Text31), 0)
Me.Text31.SelLength = Nz(Len(Me.Text31), 0)
End Sub
The code that doesn't work is:
Private Sub QWG_Enter()
Me.QWG.SetFocus
Me.QWG.SelStart = Nz(Len(Me.QWG), 0)
Me.QWG.SelLength = Nz(Len(Me.QWG), 0)
End Sub

William B.
100% (61)Projects Completed
30
Freelancers worked with
26
Projects awarded
73%
Last project
7 Jun 2023
United States
New Proposal
Login to your account and send a proposal now to get this project.
Log inClarification Board Ask a Question
-
Hi William
Please post your existing VBA code.
Many thanks
Ian CWilliam B.06 Dec 2016The code that works is:
Private Sub Text31_Enter()
Me.Text31.SetFocus
Me.Text31.SelStart = Nz(Len(Me.Text31), 0)
Me.Text31.SelLength = Nz(Len(Me.Text31), 0)
End Sub
The code that doesn't work is:
Private Sub QWG_Enter()
Me.QWG.SetFocus
Me.QWG.SelStart = Nz(Len(Me.QWG), 0)
Me.QWG.SelLength = Nz(Len(Me.QWG), 0)
End Sub
252575
We collect cookies to enable the proper functioning and security of our website, and to enhance your experience. By clicking on 'Accept All Cookies', you consent to the use of these cookies. You can change your 'Cookies Settings' at any time. For more information, please read ourCookie Policy
Cookie Settings
Accept All Cookies