If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Tabbed Form Design
How do I create a tabbed form, where the tab names and number of tabs will
change based on the outcome of a "group-by" query? (or the unique values in one field of a table). Or am I asking too much from a tabbed form? |
#2
|
|||
|
|||
Tabbed Form Design
"G2" wrote in message
... How do I create a tabbed form, where the tab names and number of tabs will change based on the outcome of a "group-by" query? (or the unique values in one field of a table). Or am I asking too much from a tabbed form? You can add tabs to a form programmatically, but the form must be open in design view. It's generally better to create the maximum number of tabs you will need at design time, and toggle their visibility at run time, which does not require the form to be in design view. Here's an example that gets the number of tabs and their captions from text boxes on the form ... Private Sub cmdBuildTabs_Click() Dim lngPages As Long Dim lngLoop As Long Dim varCaptions As Variant lngPages = CLng(Me.txtNumPages) varCaptions = Split(Me.txtTabNames, " ") For lngLoop = 0 To Me.tabTest.Pages.Count - 1 Me.tabTest.Pages(lngLoop).Visible = False Next lngLoop For lngLoop = 0 To lngPages - 1 Me.tabTest.Pages(lngLoop).Visible = True Me.tabTest.Pages(lngLoop).Caption = varCaptions(lngLoop) Next lngLoop End Sub -- Brendan Reynolds |
Thread Tools | |
Display Modes | |
|
|