Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Move cursor to end of text

Posted on 2012-03-18
2
Medium Priority
?
310 Views
Last Modified: 2012-03-18
Hi All

I have a subform in single form mode that has a note field. Because I have enter behavior set to highlight field when I move between records,  the whole of the note fields text is highlighted. This means that if someone accidentally presses a key on the keyboard the whole note field is deleted to allow new data to be entered. I don't want to alter the default enter behavior because it is usefull elswhere and I don't want to set the focus to another field because that will be highlighted and suffer the same problem.

So what I need in the OnCurrent property of the subform is
If "Notes" (The Note Control)  has focus then move cursor to end of field or text.
0
Comment
Question by:DatabaseDek
2 Comments
 
LVL 16

Accepted Solution

by:
kmslogic earned 2000 total points
ID: 37734997
On the Enter event of your textbox that contains your notes (which gets fired when you enter the field) do this:


private sub tbMyField_Enter()
     me.tbMyField.SelStart = me.tbMyField.SelLength
end sub

Open in new window

0
 

Author Closing Comment

by:DatabaseDek
ID: 37735036
Brilliant

Thank you

(Where do you learn this stuff?) I spent an hour looking for it!
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

972 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question