CopyfromRecordset DAO问题 [英] CopyfromRecordset DAO issues

查看:103
本文介绍了CopyfromRecordset DAO问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到运行时430错误,类不支持自动化或不支持预期的接口使用以下代码。它似乎与使用DAO而不是ADODB有关。这段代码是两个代码的组合,一个是DAO,另一个是ADODB。所以我想和两人结婚,但我遇到了问题。我没有任何偏好留在DAO或ADODB(这似乎更适合Excel导出)。但我需要帮助代码。无论如何,这里是代码(直到错误)并且发布的最后一行是被标记的内容。感谢您的帮助。


为了澄清我的参考资料,这些在我的系统中是活跃的:


Visual Basic for Applications

Microsoft Access 12.0对象库

OLE自动化

Microsoft Office 12.0 Access数据库引擎对象库

Microsoft Excel 12.0对象库

Microsoft ActiveX数据对象2.1库

I am getting a "Run-Time 430 error, Class does not support Automation or does not support expected interface" with the following code. It appears to be related to the use of DAO instead of ADODB. This code is the combination of two codes, one with DAO and the other with ADODB. So I''m trying to marry the two, but I''m having problems. I don''t have any preference to stay with DAO or ADODB (which it seems is better for Excel exporting). But I need help with the code. Anyways, here is the code (up until the error) and the last line posted is what is being flagged. Thanks for your help.

And to clarify my references, these are active on my system:

Visual Basic for Applications
Microsoft Access 12.0 Object Library
OLE Automation
Microsoft Office 12.0 Access database engine Object library
Microsoft Excel 12.0 Object Library
Microsoft ActiveX Data Objects 2.1 Library


展开 | 选择 | Wrap | 行号

推荐答案

我没有在y中看到Microsoft DAO对象库引用我们的列表,很可能是您的错误消息的原因
I do not see the Microsoft DAO Object Library reference in your listing, that could very well be the cause of your error message


我试图激活Microsoft DAO 3.6库,但它告诉我名称与现有模块冲突,项目或对象库。
I''ve tried to activate the Microsoft DAO 3.6 Library but it tells me that the "name conflicts with existing module, project or object library."


尝试丢失Microsoft ActiveX Data Objects 2.1库在添加DAO参考之前。


此外,确保所有引用都是明确的。特别是第6行。


最后一点,试着养成将所有Dim线放在代码顶部的习惯,在它的范围内它是有效的。 IE浏览器。程序的 Dim 应该在程序的开始处,模块的 Dim 应该在模块的开头。它让您和其他任何需要查看代码的人都能轻松生活。
Try losing "Microsoft ActiveX Data Objects 2.1 Library" before adding the DAO reference.

Also, ensure all your references are explicit. Line #6 specifically is not.

Last point, try to get into the habit of putting all your Dim lines at the top of the code within whose scope it is effective. IE. Dims for a procedure should be at the start of the procedure and Dims for a module should be at the start of the module. It makes life easier both for yourself and anyone else who ever has to review your code.


这篇关于CopyfromRecordset DAO问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆