returning the focus from a tab control
am 14.11.2007 22:41:38 von rdpacer
I have a form where on current, it evaluates some fields to determine
which page on a tab control should be displayed and which should be
hidden. If I cycle through the records using the navigation buttons,
the focus will remain on the "ID" field if the tab control remains on
the same page. (The ID field is not part of the tab control). Once
it reaches a record that requires a different tab to display, it takes
the cursor down to the first field in the tab control. I've attempted
to change the tab order to put the ID field first, and have tried
DoCmd.GoToControl me.ID with no success.
The biggest problem this is presenting for the users is the search
function. When they hit "find next", it is no longer focused on the
proper control.
Overall, I don't necessarily want to put the focus back on a hardcoded
control. I need it to recognize that it is no longer on the same
control and to return to the previous.
Thanks to anyone who can help out.
Re: returning the focus from a tab control
am 15.11.2007 02:34:00 von Pachydermitis
On Nov 14, 1:41 pm, "rdpa...@yahoo.com" wrote:
> I have a form where on current, it evaluates some fields to determine
> which page on a tab control should be displayed and which should be
> hidden. If I cycle through the records using the navigation buttons,
> the focus will remain on the "ID" field if the tab control remains on
> the same page. (The ID field is not part of the tab control). Once
> it reaches a record that requires a different tab to display, it takes
> the cursor down to the first field in the tab control. I've attempted
> to change the tab order to put the ID field first, and have tried
> DoCmd.GoToControl me.ID with no success.
>
> The biggest problem this is presenting for the users is the search
> function. When they hit "find next", it is no longer focused on the
> proper control.
>
> Overall, I don't necessarily want to put the focus back on a hardcoded
> control. I need it to recognize that it is no longer on the same
> control and to return to the previous.
>
> Thanks to anyone who can help out.
I am a little tired and don't think I am completely comprehending what
you are asking.
So I will answer all the questions that seem to apply and hopefully
one will be what you are looking for.
If your control name is txtID, use me.txtID.setfocus to go to it.
In the control properties there is a tabstop field that you can set to
no if you don't want users to tab there.
In form properties you can set the tabs to cycle several things,
record, page, everything, etc.
The on keydown event is great for grabbing the enter key on one
control and applying some other function then discarding the keystroke
(docmd.cancelevent I think).
Hope one helps
P
Re: returning the focus from a tab control
am 26.11.2007 17:48:28 von Pachydermitis
On Nov 15, 9:55 am, "rdpa...@yahoo.com" wrote:
> I'm going with the first option of me.[ID].setfocus.
>
> This will be okay in most cases because they will most often be
> searching the ID field. It would be perfect if it could recognize
> that it moved to a different control and set the focus back to the
> previous control.
>
> Thanks so far.
There are also lost focus and exit events you can use to know when the
user is leaving a control. If you want to make sure they are putting
the right data in use the before update event and set 'Cancel' equal
to true to force the user to stay in a control until it is filled
properly.
HTH
P