Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Detect Deviation From Tab Order

0 views
Skip to first unread message

Tom

unread,
May 8, 2006, 7:09:31 AM5/8/06
to
A form has twenty-some controls. If a user is on X, tab order is set to go
to Y next. When a user is on X, how do you detect if the user goes to one of
the other twenty-some controls rather than Y?

Thanks!


Rob Parker

unread,
May 8, 2006, 7:39:35 AM5/8/06
to
Well, I guess you could put something like this in the GotFocus event of
each control:

If Screen.PreviousControl.TabIndex <> Screen.ActiveControl.TabIndex - 1
Then ...

You'd need to ensure that the tab order is contiguous for all enabled
controls (eg. that disabled controls don't have tab stops set, with a tab
index within the range you want).

I think, though, that if you need to enforce the order in which users move
between controls that there's something wrong with your user interface -
it's not what anyone will expect.

HTH,

Rob

"Tom" <pse...@email.com> wrote in message
news:LFF7g.4$y4...@newsread2.news.pas.earthlink.net...

Arvin Meyer [MVP]

unread,
May 8, 2006, 7:51:07 AM5/8/06
to
I would proceed by filling a static form level variable in the On Exit
event. Use the On Enter event of the next control to check the variable.
Something like:

Dim strWhatever As String

Sub txtControl6_Exit(Cancel As Integer)
If strWhatever = 5 Then
strWhatever = 6
End If
End Sub

Sub txtControl7_Enter()
If strWhatever <> "6" Then
MsgBox "Bad User! Go to the corner.", vbOKOnly
strWhatever = 5
txtControl6.SetFocus
End If
End Sub

You'll need to play with this a little to keep from sticking yourself in a
loop.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads
http://www.datastrat.com
http://www.mvps.org/access

"Tom" <pse...@email.com> wrote in message
news:LFF7g.4$y4...@newsread2.news.pas.earthlink.net...

Access Resource

unread,
May 8, 2006, 3:01:02 PM5/8/06
to
Recycling the fake names, eh Steve? I see you're still trying to fool people
into thinking you're not really PC Datasheet. You've asked hundreds of
questions while pretending to be hundreds of different people. Take a look
at
http://www.accessresource.somee.com/WhyYouCantPlonkPCDatasheet.asp

Chris Mills
Your Access Resource

Get a discount!
http://www.accessresource.somee.com/Specials.html

See why you don't want to go to Access Hell
http://www.accessresource.somee.com/Links.html

0 new messages