Mouse click in field

F

Flick Olmsford

Is there a way to locate the cursor at the beginning of a field automatically
when you click in a field. Right now, the cursor jumps into the middle of
the field and my users do not like that.

I know you can do this if you tab into the field, but my users use the mouse
to move more often.
 
A

Al Campagna

Flick,
Using the control's OnClick event of example LastName
LastName.SelStart = 0
will place the cursor before the first character.

But... you probably meant to have the LastName "fully selected"... and
ready for over-typing, when clicking in.
LastName.SelStart = 0
LastName.SelLength = Len(LastName)
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."
 
A

Al Campagna

Flick,
Change my previous code suggested to...
Date1.SelStart = 0
Date1.SelLength = Len(Nz(Date1))
This prevents "Invalid use of null" when clicking into an empty LastName
control.

--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."
 
F

Flick Olmsford

Thanks. I was kind of hoping for one setting though for the entire form but
this will do. I can probably create some code that sets this on the form
opening.
 
A

Al Campagna

Flick,
Actually there is a built in method in Access to do just that.
If the Text Control has an associated label, the user can
click the label, and the fields contents will be highlited...
just as if you tabbed into it.
Click the label
|
V
LastName: ___________
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."
 
L

Linq Adams via AccessMonster.com

This is really going to have to be done a control by control basis, I'm
afraid, rather than setting all controls when the form loads.

Just as a side note, doing the

LastName.SelStart = 0

thing in the control's OnClick event is an absolute ***must*** when using
Input Masks! Otherwise, users like yours will click on the control somewhere
other than the beginning of the field, start typing, and get really upset
when they get an error because the entered data didn't meet the mask's
requirement! They then have to go back and re-enter it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top