By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,653 Members | 1,847 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,653 IT Pros & Developers. It's quick & easy.

Setfocus jumps to next field, but default value is selected in that field.

P: n/a
I use SetFocus to jump from one field to another. That works fine. But
one of the focussed fields has default text and this text is selected
and the cursor is on the left of it. How to have the curosr positioned
at the right of the default (or filled) text?

Bart
(v 2003)

Feb 18 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a

"AA Arens" <ba***********@gmail.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...
I use SetFocus to jump from one field to another. That works fine. But
one of the focussed fields has default text and this text is selected
and the cursor is on the left of it. How to have the curosr positioned
at the right of the default (or filled) text?

Bart
(v 2003)


First things first, why are you using SetFocus jump from one field to
another? Why don't use set the tab order correctly?

Here's a solution for your question

After the line Me![FieldName].SetFocus
Me![FieldName].SelStart = Len(Me![FieldName])

Jeff
Feb 18 '06 #2

P: n/a
Hi Jeff,

It works. I use SetFocus as most of the field as list boxes and after
selecting the right value it jumps to the next value which it does not
with only TAB or when there is no List Box. I already set the right TAB
order.
Regarding that, when there is no list box, I use to use TAB. How to
have the cursor also jumped to the right?
I guess I need to choose the KeyPress part.

Bart

Feb 18 '06 #3

P: n/a
AA Arens wrote in message
<11********************@g43g2000cwa.googlegroups.c om> :
Hi Jeff,

It works. I use SetFocus as most of the field as list boxes and after
selecting the right value it jumps to the next value which it does not
with only TAB or when there is no List Box. I already set the right TAB
order.
Regarding that, when there is no list box, I use to use TAB. How to
have the cursor also jumped to the right?
I guess I need to choose the KeyPress part.

Bart


The lazy way, could be to enter Tools | Options - in the Keyboard tab,
then akter the "Behavior entering field" property (Go to end of field).

This can be manipulated programatically too, if you like (some typed
not tested sample)

' declaration section
private lngProp as long

' in a sub...
lngProp = application.getoption("behavior entering field")
if lngProp <> 2 then
application.setoption "behavior entering field", 2
end if

' then afterwards (form close/unload?) reset

BTW - if you intend to try to trap through some of the key events, try
the KeyDown. I dont think the KeyPress will catch keys that will cause
the focus to change ...

--
Roy-Vidar
Feb 18 '06 #4

P: n/a

"AA Arens" <ba***********@gmail.com> schreef in bericht news:11**********************@g44g2000cwa.googlegr oups.com...
I use SetFocus to jump from one field to another. That works fine. But
one of the focussed fields has default text and this text is selected
and the cursor is on the left of it. How to have the curosr positioned
at the right of the default (or filled) text?


You will need to look at Selstart in Help

Arno R
Feb 21 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.