请各位帮帮忙。
Option Explicit
Public appdisk As String
Public conn As New ADODB.Connection
Public Rs As New ADODB.Recordset
Public db As String
Private sSQL As String
Private Sub Combo1_Click()
Dim search1 As String
Dim s As String
s = "selcet * from users"
Combo2.Clear
search1 = Combo1.Text
Adodc1.RecordSource = s
Adodc1.CommandType = adCmdText
Do Until Adodc1.Recordset.EOF ' 报错 对象变量或With块未设置
If Adodc1.Recordset.Fields(search1) <> "" Then
Combo2.AddItem Adodc1.Recordset(search1)
End If
Adodc1.Recordset.MoveNext
Loop
Adodc1.Recordset.MoveNext
End Sub
Private Sub Form_Load()
'Dim conn As ADODB.Connection
'Dim Rs As ADODB.Recordset
'Dim db As String
'On Error GoTo tt
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\Administrator\桌面\1\Alex.mdb;Persist Security Info=False"
conn.Open
Combo1.AddItem ("ID")
Combo1.AddItem ("password")
Combo1.AddItem ("level")
'tt:
'MsgBox Err.Number
End Sub
报错 对象变量或With块未设置,怎么解决。
谢谢