所设计的库存程序Combo控件的问题
首先,这是界面这是程序运行时的界面
选择Combo控件列表框中的钢材,记录仍指向第一条,而下面的详细内容也没有变,此问题,如何解决?
Combo1代码:
程序代码:
Private Sub cmbField_Click() Dim i As String cmbname.Clear i = Adodc1.RecordSource = "select * form 库存表" Adodc1.Refresh Do While Not Adodc1.Recordset.EOF cmbname.AddItem Adodc1.Recordset.Fields(cmbField.Text) Adodc1.Recordset.MoveNext Loop cmbname.Text = cmbname.List(0) End SubCombo2代码:
程序代码:
Private Sub cmbname_Click() Dim condition Dim s As String condition = Trim(cmbField.Text) If Adodc1.Recordset.Fields(condition).Type = 202 Then s = Adodc1.RecordSource = "select * form 库存表 where " & condition & "='" & cmbname.Text & "'" Else s = Adodc1.RecordSource = "select * form 库存表 where" & condition & "=" & cmbname.Text End If Adodc1.Refresh txtno.Text = Adodc1.Recordset.Fields("货物编号") txtname.Text = Adodc1.Recordset.Fields("货物名称") txtstocknumber.Text = Adodc1.Recordset.Fields("库存量") txtunit.Text = Adodc1.Recordset.Fields("单位") End Sub如何修改?谢谢。