使用adodc控件,
Private Sub Form_Activate()
S = App.Path & "\db1.mdb"
Adodc2.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source =" + Chr(34) + S + Chr(34) & ";Jet OLEDB:Database Password=chen3523;" '打开有密码数据库,密码为“chen3523”
= adCmdTable
Adodc2.RecordSource = "a1表"
Adodc2.Refresh
Set DataCombo1.RowSource = Adodc2
DataCombo1.ListField = "名字"
End Sub
在textbox框属性中设置:datasource为adodc2,datafild为“职业”。应该可以了