'this is how I create the sstab:
Private Sub createTabs(ByVal mCon As ADODB.Connection)
Dim rs As ADODB.Recordset
Set rs = db.getAllTables(mCon)
Dim i As Integer
Dim maxWidth As Integer
i = 0
Set sTab = Me.Controls.Add("TabDlg.SSTab", "Tab1", Me)
sTab.Font = Me.Font
With sTab
.Left = 100
.Height = Me.Height - cmdSave.Height - 1000
.Top = 100
If rs.RecordCount <= 11 Then
.TabsPerRow = rs.RecordCount - 1
Else
.TabsPerRow = (rs.RecordCount - 1) / 2 + 1
End If
.Tabs = rs.RecordCount - 1
Do While Not rs.EOF
If rs.Fields("TABLE_NAME").Value <> "tblOptions" Then
.TabCaption(i) = rs.Fields("TABLE_NAME").Value
End If
If maxWidth < TextWidth(rs.Fields("TABLE_NAME").Value) Then
maxWidth = TextWidth(rs.Fields("TABLE_NAME").Value)
End If
i = i + 1
rs.MoveNext
Loop
.TabMaxWidth = maxWidth + 250
Me.Width = .Width + 300
.Visible = True
End With
Set rs = Nothing
End Sub
'and this is my attempt to populate each tab with checkboxes
Private Sub populateTabs(ByVal mCon As ADODB.Connection)
Dim rs As ADODB.Recordset
Dim iTab As Integer
Dim iRowCounter As Integer
Dim chkBox As CheckBox
Dim theLeft As Integer
Dim theTop As Integer
theLeft = 100
theTop = 500
For iTab = 0 To sTab.Tabs - 1
sTab.Tab = iTab
Set rs = db.getRecordSet("select field_name, show_field, is_key from tblOptions " _
& "where table_name='" & sTab.TabCaption(iTab) & "'", mCon)
Do While Not rs.EOF
Set chkBox = Me.Controls.Add("VB.Checkbox", "CheckBox" & iCheckBox, sTab)
With chkBox
.Width = 2000
.Height = 375
.Left = theLeft
.Top = theTop
.Caption = rs.Fields("field_name").Value
.Value = rs.Fields("show_field").Value
.Enabled = CBool(rs.Fields("is_key").Value)
.Visible = True
End With
Set chkBox.Container = sTab
iRowCounter = iRowCounter + 1
iCheckBox = iCheckBox + 1
iTab = iTab + 1
If iRowCounter Mod 10 = 0 Then
theTop = 100
theLeft = theLeft + 2100
Else
theTop = theTop + 450
End If
rs.MoveNext
Loop
Next iTab
Set rs = Nothing
End Sub