第一个列表框
Private Sub cmbfield_Click()
cmbname.Clear
Adodc1.RecordSource = "HXKH"
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 Sub第二个列表框
Private Sub cmbname_Click()
Dim condition
condition = cmbfield.Text
If Adodc1.Recordset.Fields(condition).Type = 202 Then
Adodc1.RecordSource = "HXKH where" & condition & " = '" & cmbname.Text & "'"
Else
Adodc1.RecordSource = "HXKH where" & condition & " = " & cmbname.Text
End If
Adodc1.Refresh
txtno.Text = Adodc1.Recordset.Fields("客户编号")
txtname.Text = Adodc1.Recordset.Fields("产品名称")
txtdate = Adodc1.Recordset.Fields("日期")
txtnum.Text = Adodc1.Recordset.Fields("数量")
txtprice.Text = Adodc1.Recordset.Fields("单价")
txtall.Text = Adodc1.Recordset.Fields("金额")
End Sub建立了2个列表框,第一个列表框读取数据库的字段值,可以正常读取,然后第二个列表框,根据第一个列表框的字段,可以相应的选取该字段所有包含的值,下面有2个错误,第一个,比如,我选择了第一个列表框的客户编号字段,第二个列表框会出现相应的值,但是如果我选择数量,单价,金额这些字段,就会提示"实时错误94,无效使用null",也就是文本的可选,数值的不可选,求解决的方法