Select entire field when you left click on control

DJBummy

Registered User.
Local time
Today, 16:19
Joined
Jun 22, 2001
Messages
90
After some exhausting searching for this solution in this forum. I found this on another sight posted by Steve Schapel

http://groups.google.com/group/micr...8da2c476b07/5cd980561ac938d6#5cd980561ac938d6

Thought I would post here to save someone else some time.
If someone has already posted this code I appologize in advance.

Private Sub DueDate_Click()
With Me.DueDate
.SelStart = 0
.SelLength = Len(.Text)
End With
End Sub

This allows the user to left click in the DueDate field and select all of the data to change without having to left click and drag.

HTH.
 
Only problem I see with this is it will prevent your user from simply clicking on the field to, say, change one character. They'll have to click on the control, deselect the text, move to the errant character and then correct it. Why not leave Click alone, and instead place the code in the DoubleClick event?
 
Yes I see your point.
Actually the fields i put this code into are short data entry fields. ae: duedate is a month/day entry, another is a currency entry of usually only 100 or less dollars. So the ability to do what you said is really not that much of a problem. In other words the user can simply just type in the new data without too much effort. Also the user can use the arrow keys to move to whichever character they wish to correct if they wish.
I do thank you for your suggestion. I did not think of that.
Thanks
 
Last edited:

Users who are viewing this thread

Back
Top Bottom