|
|

Controlling where the cursor is when the user enters a field
There are two ways that you can control where the cursor is when the user enters a field:
- You can set the 'Behaviour Entering Field' property to 'Select Entire Field', 'Go To Start of Field' or 'Go To End of Field'. This option is an Access-wide setting, and can be set from Tools|Options on the Keyboard tab;
- Or else you can control what happens on an individual control basis by using the control's OnGotFocus property.
Below is some code that I have used to set the focus to the end of the control, regardless of the Access settings:
Private Sub txtShipCountry_GotFocus()
Me!txtShipCountry.SelStart = 0
End Sub
|
Or to position the cursor at the end of the control:
Private Sub txtShipCountry_GotFocus()
Me!txtShipCountry.SelStart = Len(Me!txtShipCountry)
End Sub
|
Or to ensure that the entire field is selected:
Private Sub txtShipCountry_GotFocus()
Me!txtShipCountry.SelStart = 0
Me!txtShipCountry.SelLength = Len(Me!txtShipCountry)
End Sub
|
Top
HOME |
NEW |
TABLES |
QUERIES |
FORMS |
REPORTS |
GENERAL |
API |
DOWNLOADS |
TUTORIAL |
RESOURCES
E-MAIL
Copyright & Disclaimer
|
| |