VB中如何选取combo1下拉列表中值后在combo2下拉列表显示对应项?以此类推 5
表instruments(实验室名称,实验室编号,仪器名称,仪器编号)combo1:实验室名称combo2:仪器名称combo3:仪器编号combo1中显示实验室名称的代...
表instruments(实验室名称,实验室编号,仪器名称,仪器编号)
combo1:实验室名称
combo2:仪器名称
combo3:仪器编号
combo1中显示实验室名称的代码如下:
DbConn Adodc3, "instruments"
Dim sql As String
sql = "select distinct 实验室名称 from instruments"
Adodc3.RecordSource = sql
Adodc3.Refresh
For i = 0 To Adodc3.Recordset.RecordCount - 1
Combo1.AddItem Adodc3.Recordset.Fields("实验室名称").Value
Adodc3.Recordset.MoveNext
Next 展开
combo1:实验室名称
combo2:仪器名称
combo3:仪器编号
combo1中显示实验室名称的代码如下:
DbConn Adodc3, "instruments"
Dim sql As String
sql = "select distinct 实验室名称 from instruments"
Adodc3.RecordSource = sql
Adodc3.Refresh
For i = 0 To Adodc3.Recordset.RecordCount - 1
Combo1.AddItem Adodc3.Recordset.Fields("实验室名称").Value
Adodc3.Recordset.MoveNext
Next 展开
1个回答
展开全部
Private Sub Combo1_Click()
DbConn Adodc3, "instruments"
Dim sql As String
sql = "select distinct 实验室名称 from instruments"
Adodc3.RecordSource = sql
Adodc3.Refresh
For i = 0 To Adodc3.Recordset.RecordCount - 1
Combo2.AddItem Adodc3.Recordset.Fields("仪器名称").Value
Adodc3.Recordset.MoveNext
Next
End Sub
Private Sub Combo2_Click()
DbConn Adodc3, "instruments"
Dim sql As String
sql = "select distinct 实验室名称 from instruments"
Adodc3.RecordSource = sql
Adodc3.Refresh
For i = 0 To Adodc3.Recordset.RecordCount - 1
Combo3.AddItem Adodc3.Recordset.Fields("仪器编号").Value
Adodc3.Recordset.MoveNext
Next
End Sub
追问
谢谢啊!这个程序你试过没? 我怎么解决不掉呢?
追答
亲 你想多了。这个程序我这里肯定没办法调试,因为 上面都是你给的数据,我只是告诉你方式
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询