为了打开活动的ADODB.Connection 对象之上的ADODB.recordset,并且将ADODB对象连接到student.mdb范例数据库,编写了下面的代码:
Private cnnNwind As New ADODB.Connection
Private rstNwind As New ADODB.Recordset
Private blnHasRun As Boolean
Private Sub Form_Activate()
If blnHasRun Then
Exit Sub
End If
Dim strSQL As String
DoEvents
cnnNwind.Provider = "Microsoft.Jet.OLEDB.3.51"
cnnNwind.Open "E:\student.mdb", "Admin"
strSQL = "SELECT * FROM Customers"
With rstNwind
Set .ActiveConnection = cnnNwind
.CursorType = adOpenKeyset
.LockType = adLockOptimistic
.Open strSQL
End With
Set adcNwind.Recordset = rstNwind
blnHasRun = True
End Sub
大家看一下这段代码,运行的时候报错:如下:The Microsoft Jet database engine cannot find the input table or query'customers' .Make sure it exits and that its name is spelled correctly .这是什么原因?帮忙看看谢谢了!