Originally posted by indhu
just explain your problem and then what you need.
Dim conn As New ADODB.Connection
Dim rstRecordSet As New ADODB.Recordset
Dim strSql As String
Private Sub Combo1_Change()
Combo1_Click
End Sub
Private Sub Combo1_Click()
strSql = ""
strSql = "select field0,field1,field2,field3 from tblOtherTable where TableId = " & Combo1.ItemData(Combo1.ListIndex)
Set rstRecordSet = Nothing
rstRecordSet.CursorLocation = adUseClient
rstRecordSet.Open strSql, conn, adOpenDynamic, adLockOptimistic
If rstRecordSet.RecordCount > 0 Then
Text1.Text = rstRecordSet.Fields("field0")
Text2.Text = rstRecordSet.Fields("field1")
Text3.Text = rstRecordSet.Fields("field2")
Text4.Text = rstRecordSet.Fields("field3")
End If
Set rstRecordSet = Nothing
End Sub
Private Sub Form_Load()
LoadComboDetail
End Sub
Private Sub LoadComboDetail()
Dim i As Integer
strSql = ""
strSql = "select TableId,TableFetchDetail from tblTableName"
Set rstRecordSet = Nothing
rstRecordSet.CursorLocation = adUseClient
rstRecordSet.Open strSql, conn, adOpenDynamic, adLockOptimistic
If rstRecordSet.RecordCount > 0 Then
For i = 1 To rstRecordSet.RecordCount
Combo1.AddItem rstRecordSet("TableFetchDetail")
Combo1.ItemData(Combo1.NewIndex) = rstRecordSet("TableId")
rstRecordSet.MoveNext
Next i
End If
Set rstRecordSet = Nothing
End Sub
scenecombo.ItemData(scenecombo.NewIndex) = rstRecordSet("sceneid")
Comment