Myrna Larson
Registered User.
- Local time
- Today, 03:00
- Joined
- Aug 3, 2012
- Messages
- 16
Several years ago I designed a form for entering data in an Access 2003 database. It has event code and many VBA macro functions which work fine. (I was an Excel MVP years ago, one of the top posters in the VBA programming section, so VBA is not a problem for me.)
I am now updating this mdb database using Access 2010 (but it's still in mdb format).
The problem is that since I moved a particular text box from the main part of a form to the 2nd page of a tab Control, when I enter this text box, all text is selected. I want ONLY an insertion point.
The Client Setting for behavior on entering field is go to start of field. That should eliminate my problem, but it doesn't.
The data source the problem control is a Memo field. When this text box was on the main form, a macro for the Enter event set the selection start to 0 and the length to 0. (Actually I shouldn't need this, but I did.) I moved the Notes field to Page 1 of the Tab Control. It's the only field on that page.
Typically I want to edit fields on the 1st page of the tab control. I move through fields on the 1st page using the tab key. When I use the tab key to leave the last field on Page 0, I get to the Notes memo field on the Page 1, but ALL the text is selected
!!! I have traced the code, and the Enter event macro does fire.
(Note that if the tab control is showing Page 1 and the Notes memo field when I leave the last field on the main part of the form, the tab key takes me to the Notes text box, and it has just an insertion point.)
For your information, I've copied the 2 event procedures below. Thanks for any help!
Private Sub DoHip_LostFocus()
'DoHip is the last control on the FIRST page of the tab control
' i.e. Page 0
'in fact this procedure seems to fire AFTER the Notes_Enter code
Me.tabControl.Pages(1).SetFocus
With Me.Notes
.SelStart = 0
.SelLength = 0
End With
End Sub
Private Sub Notes_Enter()
'Notes is the only control on the SECOND page of the tab control
' i.e. Page 1
With Me.Notes
.SelStart = 0
.SelLength = 0
End With
End Sub
I am now updating this mdb database using Access 2010 (but it's still in mdb format).
The problem is that since I moved a particular text box from the main part of a form to the 2nd page of a tab Control, when I enter this text box, all text is selected. I want ONLY an insertion point.
The Client Setting for behavior on entering field is go to start of field. That should eliminate my problem, but it doesn't.
The data source the problem control is a Memo field. When this text box was on the main form, a macro for the Enter event set the selection start to 0 and the length to 0. (Actually I shouldn't need this, but I did.) I moved the Notes field to Page 1 of the Tab Control. It's the only field on that page.
Typically I want to edit fields on the 1st page of the tab control. I move through fields on the 1st page using the tab key. When I use the tab key to leave the last field on Page 0, I get to the Notes memo field on the Page 1, but ALL the text is selected

(Note that if the tab control is showing Page 1 and the Notes memo field when I leave the last field on the main part of the form, the tab key takes me to the Notes text box, and it has just an insertion point.)
For your information, I've copied the 2 event procedures below. Thanks for any help!
Private Sub DoHip_LostFocus()
'DoHip is the last control on the FIRST page of the tab control
' i.e. Page 0
'in fact this procedure seems to fire AFTER the Notes_Enter code
Me.tabControl.Pages(1).SetFocus
With Me.Notes
.SelStart = 0
.SelLength = 0
End With
End Sub
Private Sub Notes_Enter()
'Notes is the only control on the SECOND page of the tab control
' i.e. Page 1
With Me.Notes
.SelStart = 0
.SelLength = 0
End With
End Sub