Textbox for Memo Field

G

Guest

Have a textbox on a form with the control source of a memo field.

When I open the form all the text is highlighted (selected), which could
cause a problem if the user just starts typing.

How can I deselect the text and go to the last line of when the form is
opened?

Thanks in advance!

Dwight
 
F

fredg

Have a textbox on a form with the control source of a memo field.

When I open the form all the text is highlighted (selected), which could
cause a problem if the user just starts typing.

How can I deselect the text and go to the last line of when the form is
opened?

Thanks in advance!

Dwight

Code the control's Enter event:
Me![ControlName].SelStart = Nz(Len(Me![ControlName]))
 
J

Joan Wild

Dwight said:
Have a textbox on a form with the control source of a memo field.

When I open the form all the text is highlighted (selected), which
could cause a problem if the user just starts typing.

I assume you mean that when the user tabs to enters the textbox that all the
text is highlighted. If so, then in the On Enter property for the textbox,
choose [Event Procedure], and click the build button. Put
Me!textboxname.SelStart = Me!textboxname.SelLength
in between the Private Sub textboxname_Enter() and End Sub lines.
How can I deselect the text and go to the last line of when the form
is opened?

This makes me wonder if you actually mean that when the form opens you wish
to go to a new record. If that's what you mean, then you can set the form's
Data Entry property to yes. That will open the form with no records
showing. If you want the form to have records showing, but just be at a new
record, then in the On Open property choose Event Procedure and put
DoCmd.GoToRecord , , acNewRec
 
S

Steve Schapel

Dwight

Try it like this...

With Me.YourTextbox
.SetFocus
.SelLength = 1
.SelStart = Len(.Text)
End With
 
G

Guest

Thank you fredg ~ that worked great!

fredg said:
Have a textbox on a form with the control source of a memo field.

When I open the form all the text is highlighted (selected), which could
cause a problem if the user just starts typing.

How can I deselect the text and go to the last line of when the form is
opened?

Thanks in advance!

Dwight

Code the control's Enter event:
Me![ControlName].SelStart = Nz(Len(Me![ControlName]))
 
Joined
Sep 1, 2011
Messages
1
Reaction score
0
how can you deselect the text and start cursor at the top instead of at the bottom?

Thanks
 

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