Sub gettransfers(iname As String) Dim cnn As ADODB.Connection Dim rst As ADODB.Recordset Dim sSQL As String Dim r1 As Range 'build a SQL String to get all fields for fields sSQL = "SELECT date,type,name,goodstype,goods,quantity FROM logtable" sSQL = sSQL & " WHERE name Like " & iname accpath = ThisWorkbook.Path + "\" + "log.mdb" 'open the connection Set cnn = New ADODB.Connection With cnn .Provider = "Microsoft.Jet.OLEDB.4.0" .Open accpath End With 'define the recordset Set rst = New ADODB.Recordset rst.CursorLocation = adUseServer rst.Open Source:=sSQL, _ ActiveConnection:=cnn, _ CursorType:=adOpenForwardOnly, _ LockType:=adLockOptimistic, _ Options:=adCmdText Set r1 = Sheets("Interface").Range("b23") r1.CopyFromRecordset rst rst.Close cnn.Close End Sub 帮忙看看以上的代码,错误.在哪里? 提示说,至少有一个参数没有指定值 |