ACCESS 开发中的版本问题

hello1998 2005-03-14 09:20:10
问题概述:
ACCESS开发时, 如何做才能做到各操作系统(如 WIN2000 PRO, WIN XP, WIN98), 各OFFICE版本(如OFFICE 2000, OFFICE2002, OFFICE2003, OFFICE XP)下,及 OFFICE的安装路径不同(比如有在C盘, 有在D盘)的情况下都能正常运行.

背景描述:
我开发了一个小的管理系统. 开发环境是: 中文版 式WINDOWS2000 PRO, office 2000 (没有装SP1, 及SP2等补丁程序) (声明一下, 都是从电子商场买来的盗版). 这个系统开发完毕后, 在公司的正版环境下(WIN 2000, 及 WIN XP 下的OFFICE 2002 SP2, 均为日文版) 能正常运行. 但到了客户那(正版的WIN XP, OFFICE 2000 SP1, 简体中文版. 没有注意OFFICE的安装盘径), 却出错. 系统提示为: ActiveX 不能生成 对象. 调试时, 发现是在下面的代码处出了问题:
Set rs = CurrentDb.OpenRecordset(strSql)
注: 前面定义语句为: dim rs as object. 一开始想定义为:dim rs as recordset . 但系统不认.

 我又利用ACCESS自带的模板项目, 建立了一个 联系管理.mdb, 发现里面操作数据库的语句类似为:
 Dim dbs As Database
 Dim rst As Recordset
 ...
 Set dbs = CurrentDb()
Set rst = dbs.OpenRecordset("TB1")
 
 但如果我也在自己的系统中定义为 dim dbs as database 时系统也编译不过去.

 我现在很困惑.为什么会出现这种情况呢. 是因为盗版问题还是因为参照问题(我自己的系统中没有什么特别参照的, 就是利用缺省的那四个参照.), 还是因为OFFICE安装路径导致的参照文件找不到而导致不能生成对象.

 请各位高手指教一下, 怎么样才能做到ACCESS开发时独立于各OS及OFFICE的版本. (语言可以先不考虑, 比如中文,日文)
...全文
137 3 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
hello1998 2005-03-16
  • 打赏
  • 举报
回复
自己顶一下.
hello1998 2005-03-14
  • 打赏
  • 举报
回复
自己顶.
hello1998 2005-03-14
  • 打赏
  • 举报
回复
具体到本次发现的BUG. 微软有一篇如下的文章来解答:
ACC2000: Error Message: ActiveX Component Can't Create Object
Article ID : 319841
Last Review : June 25, 2004
Revision : 1.0
This article was previously published under Q319841
For a Microsoft Access 97 version of this article, see 296205.

For a Microsoft Access 2002 version of this article, see 319844.

Novice: Requires knowledge of the user interface on single-user computers.


On this page
SYMPTOMS
CAUSE
RESOLUTION
MORE INFORMATION

SYMPTOMS
When you use Microsoft Access, you receive the following error message:
ActiveX component can't create object
This article describes some common causes for this error message and offers methods that you can use to resolve the issue.
CAUSE
This behavior can occur if any of the following conditions are true: • Data Access Objects (DAO) is not properly registered.

-or-
• One or more references are missing.

-or-
• There is a utility database reference that is not valid.

-or-
• You do not have the required permissions for required libraries.

-or-
• There is a damaged wizard file.

RESOLUTION
Cause 1: DAO Is Not Properly Registered
Resolution
1. On the computer that hosts Microsoft Windows Terminal Server or the computer on which Microsoft Access is installed, click Start, and then click Run.
2. Type regsvr32 followed by the path to your DAO file. Enclose this path in quotation marks. For example, to register the DAO 3.6 library, use the following command:
regsvr32 "C:\Program Files\Common Files\Microsoft Shared\DAO\DAO360.DLL"

Cause 2: One or More References Are Missing
Resolution
1. Open the database for you receive the error message.
2. Press ALT+F11 to open the Microsoft Visual Basic Editor.
3. In the Visual Basic Editor, click References on the Tools menu.
4. Examine the list of libraries. If any items are marked as "missing," locate the library file and re-associate the reference. Or, click to clear the check box next to the library name.

Cause 3: There Is a Utility Database Reference That Is Not Valid
Resolution
1. Open the database for which you receive the error message.
2. Press ALT+F11 to open the Visual Basic Editor.
3. In the Visual Basic Editor, click References on the Tools menu.
4. Click to clear the check box next to any reference to Utility Database or Utility.mda.

Cause 4: You Do Not Have the Required Permissions for Required Libraries
Resolution
• Make sure that users have "read" permissions for all files in the following folders: Operating System Location
--------------------------------------
Windows NT, 2000, XP \Winnt\System32
Windows 95, 98, Me \Windows\System


• If you cannot grant read permissions, you can use a utility such as FileMon to determine which file or files the users do not have the required permissions to use. To obtain FileMon, visit the following Sysinternals Web site:
Sysinternals

Cause 5: There Is a Damaged Wizard File
Resolution
1. Use Windows Explorer to locate the following wizard files: Acwzmain.mde, Acwztool.mde and Acwzlib.mde.
2. Change the file name extension of each file to "old." For example, change Acwzmain.mde to Acwzmain.old.
3. Reinstall Access to restore the files.

就我开发的系统而言:
情形1: DAO Is Not Properly Registered
不对, 因为我并没有参照 DAO
情形2: One or More References Are Missing
有可能, 有可能是客户方的机器中, OFFICE的安装路径不在C盘. 尽管我只用了两个必需的参照.
情形3:There Is a Utility Database Reference That Is Not Valid
感觉不可能. 因为我没有参照其它的MDB.
情形4: You Do Not Have the Required Permissions for Required Libraries
也不对, 我在公司的环境下, 把 \Winnt\System32 的读权限去掉, 仍然能正常运行.
情形5. There Is a Damaged Wizard File
这一步是说可能有文件受损了, 需要重新安装 OFFICE.

恳请ACCESS开发高手们帮助我, 开发和部署ACCESS项目时, 需要注意什么. (基于不同的版本)
谢谢!

5,172

社区成员

发帖
与我相关
我的任务
社区描述
其他开发语言 Office开发/ VBA
社区管理员
  • Office开发/ VBA社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧