Question about tabs...

L

Larry Kahm

I know that Me!TabCtl01.Value provides the page number (index) of the tab
that was clicked.

I can use a Select Case construct to process activities based on the tab
that is active.

I have a dialog that (for now) will only work in a "forward" direction. I
need to find someway of preventing the user from going "backwards".

Is there any coding technique that will let me know which tab the user is on
(i.e., the current tab) before they clicked the new one?

Thanks - and let me take a moment to extend my holiday wishes to everyone
who supports this group and benefits from it!

Larry
 
T

Tom van Stiphout

On Wed, 24 Dec 2008 18:27:16 -0500, "Larry Kahm"

Merry Christmas to you too.
If you're using the tab control as a convenient way to build a
step-by-step wizard, you may want to consider hiding the tabs
altogether, by setting the Style property to None. Then program the
forward action (and perhaps later a backward action) yourself:
if AllFieldsFilledOut() then
Me.TabCtl01.Value = Me.TabCtl01.Value + 1 'Go forward
end if

-Tom.
Microsoft Access MVP
 
D

Dirk Goldgar

Larry Kahm said:
I know that Me!TabCtl01.Value provides the page number (index) of the tab
that was clicked.

I can use a Select Case construct to process activities based on the tab
that is active.

I have a dialog that (for now) will only work in a "forward" direction. I
need to find someway of preventing the user from going "backwards".

Is there any coding technique that will let me know which tab the user is
on (i.e., the current tab) before they clicked the new one?

I like Tom's answer, but if you really need to do what you ask, you can code
a static variable in the tab control's Change event that would record the
value after it is changed, but at the end of the procedure, so that the
previous value would be available to the code in that procedure. For
example,

'----- start of example code -----
Private Sub tabMyTab_Change()

Static intPrevPage As Integer

With Me.tabMyTab

If .Value < intPrevPage Then
' Put the user right back on the previous page.
.Value = intPrevPage
Else

Select Case .Value
' ... code to process pages goes here ...
End Select

' Record the current page as the "previous" page.
intPrevPage = .Value
End If

End With

End Sub
'----- end of example code -----
Thanks - and let me take a moment to extend my holiday wishes to everyone
who supports this group and benefits from it!

Happy holidays to you, too, Larry.
 
Top