Office中国论坛/Access中国论坛

标题: 求助--关于OpenRecordSet()方法 [打印本页]

作者: laotang    时间: 2004-8-20 02:12
标题: 求助--关于OpenRecordSet()方法
真高兴能见到"爱赛思俱乐部"的老面孔.

引用DAO2.6. 在运行,

    Dim myDb As Database

    Dim myRs As Recordset

    Set myDb = CurrentDb

    Set myRs = myDb.OpenRecordset("tbDamaged")
'tbDamaged是表名

时,报错"Type mismatch".为什么?

我在帮助中找不到OpenRecordset(Name As String, [Type], [Options], [LockEdit])方法,

请告知每个参数的用法或copy帮助文档给我;参数Name除了可以是表名外,可不可以是查询名或SQL语句?

万分感谢您的帮助!
作者: AlexLiu    时间: 2004-8-20 05:58
应该显示声明DAO:    Dim myDb As DAO.Database

    Dim myRs As DAO.Recordset

    Set myDb = CurrentDb

    Set myRs = myDb.OpenRecordset("tbDamaged")
作者: tmtony    时间: 2004-8-20 08:56
最好是如上显式引用,如果实在不想显式,也可把dao的引用顺序放在ADO引用的前面
作者: laotang    时间: 2004-8-20 11:34
谢谢两位解答




欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/) Powered by Discuz! X3.3