technohead
Technical User
Hi,
i have a form with about 15 tabs on it. on the click event of each tab a combo box is filled. this works perfectly, however when i load the form the first page has nothing in the combo box. i have to click onto another tab and then click back to the first one so that the combo box is filled.
heres the code i used below.
is there any way that this can be done without having to click to another page first.
Private Sub SSTab1_Click(PreviousTab As Integer)
If SSTab1.Tab = 0 Then
intfloortype = 1
ElseIf SSTab1.Tab = 1 Then
intfloortype = 2
ElseIf SSTab1.Tab = 2 Then
intfloortype = 3
ElseIf SSTab1.Tab = 3 Then
intfloortype = 4
ElseIf SSTab1.Tab = 4 Then
intfloortype = 5
ElseIf SSTab1.Tab = 5 Then
intfloortype = 6
ElseIf SSTab1.Tab = 6 Then
intfloortype = 7
ElseIf SSTab1.Tab = 7 Then
intfloortype = 8
ElseIf SSTab1.Tab = 8 Then
intfloortype = 9
ElseIf SSTab1.Tab = 9 Then
intfloortype = 10
ElseIf SSTab1.Tab = 10 Then
intfloortype = 11
ElseIf SSTab1.Tab = 11 Then
intfloortype = 12
ElseIf SSTab1.Tab = 12 Then
intfloortype = 13
End If
Call result(intfloortype, cbowoodtype(SSTab1.Tab))
Public Sub result(TypeNum As Integer, combo As Control)
combo.Clear
Dim adoconnection As ADODB.Connection
Set adoconnection = New ADODB.Connection
adoconnection.Open ("Provider=Microsoft.jet.oledb.4.0;" & "Data Source = C:\Final_Year_Project.mdb"
Set rs = New ADODB.Recordset
rs.Open "select WoodTypeName, WoodType_No from WoodType where FloorType_No=" & TypeNum, adoconnection
While Not rs.EOF
combo.AddItem rs("WoodTypeName"
rs.MoveNext
Wend
End Sub
i have a form with about 15 tabs on it. on the click event of each tab a combo box is filled. this works perfectly, however when i load the form the first page has nothing in the combo box. i have to click onto another tab and then click back to the first one so that the combo box is filled.
heres the code i used below.
is there any way that this can be done without having to click to another page first.
Private Sub SSTab1_Click(PreviousTab As Integer)
If SSTab1.Tab = 0 Then
intfloortype = 1
ElseIf SSTab1.Tab = 1 Then
intfloortype = 2
ElseIf SSTab1.Tab = 2 Then
intfloortype = 3
ElseIf SSTab1.Tab = 3 Then
intfloortype = 4
ElseIf SSTab1.Tab = 4 Then
intfloortype = 5
ElseIf SSTab1.Tab = 5 Then
intfloortype = 6
ElseIf SSTab1.Tab = 6 Then
intfloortype = 7
ElseIf SSTab1.Tab = 7 Then
intfloortype = 8
ElseIf SSTab1.Tab = 8 Then
intfloortype = 9
ElseIf SSTab1.Tab = 9 Then
intfloortype = 10
ElseIf SSTab1.Tab = 10 Then
intfloortype = 11
ElseIf SSTab1.Tab = 11 Then
intfloortype = 12
ElseIf SSTab1.Tab = 12 Then
intfloortype = 13
End If
Call result(intfloortype, cbowoodtype(SSTab1.Tab))
Public Sub result(TypeNum As Integer, combo As Control)
combo.Clear
Dim adoconnection As ADODB.Connection
Set adoconnection = New ADODB.Connection
adoconnection.Open ("Provider=Microsoft.jet.oledb.4.0;" & "Data Source = C:\Final_Year_Project.mdb"
Set rs = New ADODB.Recordset
rs.Open "select WoodTypeName, WoodType_No from WoodType where FloorType_No=" & TypeNum, adoconnection
While Not rs.EOF
combo.AddItem rs("WoodTypeName"
rs.MoveNext
Wend
End Sub