Log in

View Full Version : Cycle through a collection(?) of pages on a form.



mud2
11-29-2006, 09:31 PM
I have a Form with several pages. The command "Me.Page1.visible = False" sets page1 invisible. I have 13 pages, and would like to make them all (at one time or another) invisible. Then depending on other variable input, make a certain page visible.
How do I cycle through all the pages. They (seem) are all in "TabCtl1" on my form.

OBP
11-30-2006, 04:56 AM
mud, you use the "Pages Collection" of the Control Tab, I have just used this code to get the number of pages and then set them to invisible.
Dim frm As Form, pagecount As Integer, x as Integer
Dim tbc As TabControl, pge As page
Me.Age.SetFocus

Set frm = Forms!frmPatientData
Set tbc = frm!TabCtl38
pagecount = tbc.Pages.count
For x = 0 To pagecount - 1
tbc.Pages(x).Visible = False
Next x

Note that you have to ensure that "Focus" is not set to any of the "pages".