Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / May 2008

Tip: Looking for answers? Try searching our database.

Tabbed Form Design

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
G2 - 07 May 2008 05:57 GMT
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?
Brendan Reynolds - 07 May 2008 10:01 GMT
> 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

Signature

Brendan Reynolds

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.