'打开记录集 Set adoRs1 = New Recordset adoRs1.Open "gxgtweijia", adoCon, adOpenDynamic, adLockOptimistic
RefreshList1 '将型号添加到列表框中
If adoRs1.RecordCount > 0 Then adoRs1.MoveLast adoRs1.MoveFirst
ExchangeData1 False End If
Set adoRs2 = New Recordset adoRs2.Open "zhitui", adoCon, adOpenDynamic, adLockOptimistic
RefreshList2 '将型号添加到列表框中
If adoRs2.RecordCount > 0 Then adoRs2.MoveLast adoRs2.MoveFirst
ExchangeData2 False End If
End Sub
Private Sub RefreshList1() lstType1.Clear
Dim i As Integer adoRs1.MoveFirst For i = 0 To adoRs1.RecordCount - 1 lstType1.AddItem adoRs1.Fields("图号") If Not adoRs1.EOF Then adoRs1.MoveNext End If
Next i
End Sub Private Sub ExchangeData1(ByVal bSave As Boolean) If bSave Then adoRs1.Fields("H") = txt9.Text adoRs1.Fields("H1") = txt8.Text adoRs1.Fields("D") = txt7.Text
End If End Sub
Private Sub lstType1_click() Dim i As Integer i = lstType1.ListIndex
If i = -1 Then Exit Sub
If i <= adoRs1.RecordCount - 1 Then adoRs1.MoveFirst adoRs1.Move i End If
ExchangeData1 False
End Sub
Private Sub RefreshList2() lstType2.Clear
Dim i As Integer adoRs2.MoveFirst For i = 0 To adoRs1.RecordCount - 1 lstType2.AddItem adoRs2.Fields("Ⅰ型图号") If Not adoRs2.EOF Then adoRs2.MoveNext End If
Next i
End Sub Private Sub ExchangeData2(ByVal bSave As Boolean) If bSave Then adoRs2.Fields("H1") = Text1.Text
Else
Text1.Text = adoRs2.Fields("H1")
End If End Sub
Private Sub lstType2_click() Dim i As Integer i = lstType2.ListIndex
If i = -1 Then Exit Sub
If i <= adoRs2.RecordCount - 1 Then adoRs2.MoveFirst adoRs2.Move i End If