Since Access automatically highlights all of the text in a text
control (I use it to hold data from a memo field) when the control is
activated, I've added the following code to put the cursor at the end.
Private Sub txtCapability_GotFocus()
‘ Placed either behind the OnEnter or GotFocus Event of a control
named,
' in this case, txtCapability, on a form ensures that when the control
is
' activated, the cursor will automatically be placed at the END of all
' the text present in the textbox
' The "cursor at the end" code was taken from "Ten Tips for Microsoft
Access Developers"
' by Frank Rice. The code itself was created by Arvin Meyer, Microsoft
Access MVP
' and taken from a posting to the Access newsgroup
(microsoft.public.access.formscoding)
Me!txtCapability.SelStart = Me!txtCapability.SelLength
End Sub
The problem is that when I want to edit the text I can only do it at
the end (where the cursor is). In order to begin editing in the body
of the text I have to first enter a space (at the end of the original
text), then I can move the cursor to the place I want to edit. If I
move the cursor first and start typing, the new text automatically
appears at the end of the original text.
Is there some code that I can add that will automatically put in a
space so that I can immediately move the cursor to the place within
the text that I want to begin editing? Or, better yet, is there a way
to activate a text field with data from a memo field and directly
start editing wherever I place the cursor?
This text control also has a macro assigned to "On Dirty" that
automatically updates the ChangeDate field to the current date (so
that the ChangeDate will always reflect the last time the Capability
field was changed). Could this have anything to do with it?