|
Home > Archive > MS Access database support > February 2006 > Setfocus jumps to next field, but default value is selected in that field.
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Setfocus jumps to next field, but default value is selected in that field.
|
|
| AA Arens 2006-02-18, 9:23 am |
| 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)
| |
| Jeff Smith 2006-02-18, 9:23 am |
|
"AA Arens" <bartvandongen@gmail.com> wrote in message
news:1140260584.116216.310060@g44g2000cwa.googlegroups.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
| |
| AA Arens 2006-02-18, 9:23 am |
| 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
| |
| RoyVidar 2006-02-18, 9:23 am |
| AA Arens wrote in message
<1140268810.203914.3940@g43g2000cwa.googlegroups.com> :
> 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
| |
| Arno R 2006-02-21, 9:23 am |
|
"AA Arens" <bartvandongen@gmail.com> schreef in bericht =
news:1140260584.116216.310060@g44g2000cwa.googlegroups.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
|
|
|
|
|