ADODB.Recordset作为函数参数传递的类型不匹配错误
代码如下:第7行出现了 “类型不匹配”(Type dismatch)的运行时错误,代码13,中文搜索引擎和Bing没有查出原因,最后还是靠Google找到了解决方法:就是在第7行前加Call。
原因可能是因为调用的函数没有返回值,所以需要Call一下。
Public Sub GetFromAccess()
Dim myCmd As New ADODB.Command
Dim myRs As ADODB.Recordset
With myCmd
Set myRs = .Execute
End With
SaveToNewExcel(myRs)
End Sub
Private Function SaveToNewExcel(RS As ADODB.Recordset)
With RS
Do something with RS
End With
End Function
posted on 2013-03-05 17:32 Graduatedben 阅读(420) 评论(0) 编辑 收藏 举报