DBCombo数据填充问题,非combo或datacombo
为了能够实现列表框能自动查找功能,好不容易找到DBCombo这个控件,但是怎么也无法填充列表,其他combo,datacombo都能顺利填充,但就唯独DBCombo不行,,数据库结构很简单,就一列,字段名为"国家列表",代码如下,请高手赐教;Private Sub Form_Load()
Dim dbConn As ADODB.Connection
Dim Rst As ADODB.Recordset
Dim conString As String
Dim str
str = App.Path
If Right(str, 1) <> "\" Then
str = str + "\"
End If
c & str & "\data\RATE.mdb"
Set dbConn = CreateObject("ADODB.Connection")
dbConn.ConnectionString = conString
dbConn.Open
Set Rst = New ADODB.Recordset
With Rst
.CursorLocation = adUseClient
.Open "select * from country2", dbConn, adOpenForwardOnly, adLockReadOnly, adCmdText
End With
Set DBCombo1.DataSource = Rst
DBCombo1.DataField = "国家列表"
Set DBCombo1.RowSource = Rst
DBCombo1.ListField = "国家列表"
DBCombo1.MatchEntry = 0
end sub
运行提示错误:
实时错误"91"
对象变量或with变量块未设置
"""""Set DBCombo1.RowSource = Rst"""""此段飘黄
请问,问题出在哪里了?