您好,看到您解决了您4个月前提的问提,我也想达到同样的目的,您可以把代码发给我学习下吗?
http://zhidao.baidu.com/question/252271804.html?fr=qrl&cid=93&index=5...
http://zhidao.baidu.com/question/252271804.html?fr=qrl&cid=93&index=5
展开
2个回答
展开全部
Private Sub Combo1_Click()
Dim rs_co As New ADODB.Recordset
Dim Sql As String
Set conn = New ADODB.Connection
conn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db1.mdb;Mode=ReadWrite|Share Deny None;Persist Security Info=True"
conn.Open conn
Sql = "select distinct 材料名称 from 材料种类 where 材料种类='" & Combo1.Text & "'"
rs_co.Open Sql, conn, adOpenStatic, adLockOptimistic
If rs_co.EOF = True Then
Combo2.Text = ""
Combo3.Text = ""
Exit Sub
End If
Combo2.Clear
rs_co.MoveFirst
Do Until rs_co.EOF
Combo2.AddItem rs_co.Fields(0)
rs_co.MoveNext
Loop
Combo2.ListIndex = 0
rs_co.Close
Set rs_co = Nothing
End Sub
Private Sub Combo2_Click()
Dim rs_c As New ADODB.Recordset
Dim Sql As String
Set conn = New ADODB.Connection
conn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db1.mdb;Mode=ReadWrite|Share Deny None;Persist Security Info=True"
conn.Open conn
Sql = "select distinct 产品 from 材料种类 where 材料名称='" & Combo2.Text & "'"
rs_c.Open Sql, conn, adOpenStatic, adLockOptimistic
Combo3.Clear
rs_c.MoveFirst
Do Until rs_c.EOF
Combo3.AddItem rs_c.Fields(0)
rs_c.MoveNext
Loop
Combo3.ListIndex = 0
rs_c.Close
Set rs_c = Nothing
conn.Close
End Sub
我这里一共是三个combo控件 只编写前两个就行了
Dim rs_co As New ADODB.Recordset
Dim Sql As String
Set conn = New ADODB.Connection
conn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db1.mdb;Mode=ReadWrite|Share Deny None;Persist Security Info=True"
conn.Open conn
Sql = "select distinct 材料名称 from 材料种类 where 材料种类='" & Combo1.Text & "'"
rs_co.Open Sql, conn, adOpenStatic, adLockOptimistic
If rs_co.EOF = True Then
Combo2.Text = ""
Combo3.Text = ""
Exit Sub
End If
Combo2.Clear
rs_co.MoveFirst
Do Until rs_co.EOF
Combo2.AddItem rs_co.Fields(0)
rs_co.MoveNext
Loop
Combo2.ListIndex = 0
rs_co.Close
Set rs_co = Nothing
End Sub
Private Sub Combo2_Click()
Dim rs_c As New ADODB.Recordset
Dim Sql As String
Set conn = New ADODB.Connection
conn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db1.mdb;Mode=ReadWrite|Share Deny None;Persist Security Info=True"
conn.Open conn
Sql = "select distinct 产品 from 材料种类 where 材料名称='" & Combo2.Text & "'"
rs_c.Open Sql, conn, adOpenStatic, adLockOptimistic
Combo3.Clear
rs_c.MoveFirst
Do Until rs_c.EOF
Combo3.AddItem rs_c.Fields(0)
rs_c.MoveNext
Loop
Combo3.ListIndex = 0
rs_c.Close
Set rs_c = Nothing
conn.Close
End Sub
我这里一共是三个combo控件 只编写前两个就行了
来自:求助得到的回答
2011-08-29
展开全部
。。。。。。。。。。。。。。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询