求救关于VB6 COMBO1

[复制链接]
查看11 | 回复1 | 2011-3-27 11:34:22 | 显示全部楼层 |阅读模式
用ACEESS建一数据库1.mdb,库里建 表1,两个字段:字段1,字段2 有数据为
1000
100
1000
200
2000
300
2000
400
两个combo,我希望在combo1里面选1000,combo2显示100和200
也就是通过combo1帅选库里内容在combo2里显示
回复

使用道具 举报

千问 | 2011-3-27 11:34:22 | 显示全部楼层
<pre id=\"best-answer-content\" class=\"reply-text mb10\">Private Sub Combo1_Click()
With Adodc1

.RecordSource = \"select 字段2 from 表1 where 字段1=\'\" Data Source=\" Persist Security Info=False\"

.CommandType = adCmdText

.RecordSource = \"select distinct 字段1 from 表1\"

.Refresh

If .Recordset.RecordCount0 Then

While Not .Recordset.EOF

Combo1.AddItem .Recordset.Fields(\"字段1\")

.Recordset.MoveNext

Wend

End If
End With
Combo1.Text = \"\"
Combo2.Text = \"\"
End Sub
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行