Tab control

G

Guest

I'm having trouble with Select Case ...

Looking on here I find I can determine the value of a tab control...0, 1, 2,
etc.

I am trying to prevent the user from leaving a tab, or moving to another
tab, until completing what I want done at that tab. The leaving is easy, done
that. However moving to another tab is giving me fits.

Select Case Me.tabControlMain
Case 0
If something Then
response something
Me.tab0.SetFocus
End If
Case 1

End Select

If the user is on tab0, with the OnChange of the TabControl with the above
code, clicking on tab1 (or any other) the user should get my message and be
returned to tab0.
 
M

Michel Walsh

A solution would be to make the other tab pages invisible:

Me.TabControlName.Pages( IndexOrigin0).Visible = ....


Otherwise, you can check the tabcontrol value:


If Me.TabControlName.Value <> 0 Then
MsgBox "Yo! Back to page 0, boss."
Me.TabControlName=0
End If



Hoping it may help,
Vanderghast, Access MVP
 
M

Marshall Barton

Chris said:
I'm having trouble with Select Case ...

Looking on here I find I can determine the value of a tab control...0, 1, 2,
etc.

I am trying to prevent the user from leaving a tab, or moving to another
tab, until completing what I want done at that tab. The leaving is easy, done
that. However moving to another tab is giving me fits.

Select Case Me.tabControlMain
Case 0
If something Then
response something
Me.tab0.SetFocus
End If
Case 1

End Select

If the user is on tab0, with the OnChange of the TabControl with the above
code, clicking on tab1 (or any other) the user should get my message and be
returned to tab0.


Instead of setting focus, set the tab control's Value:

Me.tabControlMain = 0
 

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