Friday, July 27, 2007

Making a Tab Control Page visible

If you want to make a page in tab control visible, use the following code.

Dim tabCtl As TabControl, ctl As Control
Set tabCtl = Forms!YourFormName!tabCtrls '~Your tabcontrol that holds the pages

For Each ctl In tabCtl
If ctl.Name = "pgeIdentifier" Then
ctl.Visible = True
End If

Next ctl
Set tabCtl = Nothing

1 comment:

Anonymous said...

This won't quite work if you have multiple tabs and only want to show some of them. If you want to change the visible tab(s) in code, first make all visible and then select the one(s) you want made not visible.

Apparently Access cannot find the tab if it is "visible.false" in order to make it visible.

Also, to prevent flicker during changes on screen during a change, use echo off and echo on.