Textbox for Memo Field

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
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]))
 
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
 
Dwight

Try it like this...

With Me.YourTextbox
.SetFocus
.SelLength = 1
.SelStart = Len(.Text)
End With
 
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]))
 
Back
Top