自动化错误,对象库未注册。这个是怎么的原因呢。
Public Sub loadinput(lst As ListBox, cb As ComboBox, cnn As ADODB.Connection, rst As ADODB.Recordset, rst2 As ADODB.Recordset, zd As Dictionary, txt2 As TextBox, txt3 As TextBox, lst2 As ListBox)
'On Error Resume Next
lst.Clear
If cnn.State = 0 Then
cnn.Open "provider=Microsoft.jet.OLEDB.4.0;data source=" & mdbpath & ";Jet.OLEDB:"
End If
Sql = "select * from 录入设置"
rst.Open Sql, cnn, 1, 3
rst.MoveFirst
cb.Text = rst.Fields(3).Value
txt2 = rst.Fields(4).Value
vs1.Value = rst.Fields(4).Value
txt3 = Val(rst.Fields(5).Value)
vs2.Value = Val(rst.Fields(5).Value)
Do While Not rst.EOF
lst.AddItem rst.Fields(0).Value
zd.Add rst.Fields(0).Value, ""
rst.MoveNext
Loop
For Each c In zd.Keys
If Not zd.Exists(rst.Fields(3).Value) Then cb.AddItem c
Next
For i = 0 To lst.ListCount - 1
lst.Selected(i) = True
Next i
Set rst = Nothing
Sql = "select * from 基础信息"
rst2.Open Sql, cnn, 1, 3
rst2.MoveFirst
For i = 0 To rst2.Fields.Count
If Not zd.Exists(rst2.Fields(i).Name) Then lst.AddItem rst2.Fields(i).Name
Next i
Set rst2 = Nothing
cnn.Close
End Sub
[解决办法]