宏错误:“对象不包含自动化对象[database_name]” [英] Macro error: "The object doesn't contain the automation object [database_name]"

查看:468
本文介绍了宏错误:“对象不包含自动化对象[database_name]”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经做了很多数据库工作,但只是触及了Access的表面。我正在尝试编写一个宏(从表单上的按钮点击可执行文件),它将清除当前记录的字段的子集。


我的宏是非常简单:它有八个动作(所有SetValue),每个动作与八个字段中的一个相关联(items,right? - 从表格的字段列表中选择),每个目标表达式只是 ; null"。


我已将宏与表单上的按钮相关联,但是当我单击按钮时,出现以下弹出错误:


------------------------------------------ --------------------

该对象不包含Automation对象''my_database。''


您试图运行Visual Basic过程来为对象设置属性或方法。但是,该组件不能使属性或方法可用于自动化操作。


检查组件的文档,以获取有关其为自动化操作提供的属性和方法的信息。


------------------------------------- -------------------------


是组件吗?我的数据库?我的宏?我一直找不到与自动化能力相关的任何财产。


由于宏在第一次通话时死亡,我改变了订单这些领域,只是因为第一次通话恰好出现问题。同样的事情。

I''ve done a lot of database work, but only scratched the surface with Access. I''m trying to write a macro (executable on-click from a button on a form) that will clear a subset of the current record''s fields.

My macro is pretty simple-minded: It has eight actions (all SetValue), each one associated with one of eight fields ("items", right?--selected off the table''s field list), and each target expression is simply "null".

I''ve associated the macro with the button on the form, but when I click the button, I get the following pop-up error:

--------------------------------------------------------------

The object doesn''t contain the Automation object ''my_database.''

You tried to run a Visual Basic procedure to set a property or method for an object. However, the component doesn''t make the property or method available for Automation operations.

Check the component''s documentation for information on the properties and methods it makes available for Automation operations.

--------------------------------------------------------------

Is the "component" my database? My macro? I''ve been unable to find any a property associated with anything that speaks to "Automation-ability."

Since the macro dies at the first call, I changed the order of the fields, just on the off-chance that something just happened to be wrong with that first call. Same thing.

推荐答案

@sueb


有几种方法可以接近这种情况,其中最不可取的是通过宏。向我们提供完整的详细信息,例如:字段名称,表名称,表单名称,将这些字段设置为NULL的标准等,我们其中一人将很乐意为您提供帮助。
@sueb
There are several ways to approach this scenario, the least desirable of which would be via a Macro. Provide us with complete Details such as: Field Names, Table Names, Form Name, Criteria for setting these Fields to NULL, etc., and one of us will be glad to assist you.


那么你选择了最不可能的方法:)设置空值也有点棘手。最简单的方法是(假设它们是文本框但是用于任何控制)只是清除控件。它们被记住直接绑定到数据库,它就像在表格中工作一样。

Well you picked the most impossible way to do that :) Setting null values can be bit tricky also. Easiest way is (assume they are textboxes but goes for any control) is to just clear the controls. They are bound remember so tied directly to the database, it''s like working in the table itself.

展开 | < span class =codeLinkonclick =selectAll(this);>选择 | Wrap | 行号


感谢您的快速回复!


实际上,我正在以错误的方式解决这个问题,因为Access对这看起来如此简单的回应是如此令人费解!


我几乎不好意思显示这个数据库的结构,但我有点安慰,即使我还没有修复它,我肯定没有创建它这是.b $ b这是一个字段列表(星号字段是我要清除的字段,未明确定义的所有内容都是一段长度的文本字段):


图表#

出生日期(日期/时间)

姓氏

给定名称

其他名称

* PDF(超链接)

*日期(日期/时间)

*申请人

*优先(是/否)

*手续

*类别

*付款人

* Bucket Notes

*状态日期(日期/时间)

*状态

*状态注意

* TAR#

* Submis sion日期(日期/时间)

* ICD-9

* CPTs

*住院病人(是/否)

* TAR状态日期(日期/时间)

* TAR状态

* TAR状态注意

(另外2组已加星标的字段,与上述相同,但附有(2)和(3)。所有3组事件数据都显示在表单上。使用这样的数据库结构,我将需要总共3个相同的过程,每个过程针对不同的集合。)


这个数据库的使用方式是每个记录中仅保留最新的3个事件(上述3个事件)。通过擦除其中一个现有集合中的数据并在该集合中输入新事件的数据来捕获新事件。数据库通常一次由5个用户打开,但用户似乎并没有相互碰到太多。


此过程的目标是使用户能够快速清除一组以准备输入新事件。我想在每一组旁边都有一个按钮。


我们将非常感谢任何帮助。
Thanks for the quick replies!

It''s actually comforting that I''m going about this the wrong way, since Access''s response to what seemed so simple was so puzzling!

I’m almost embarrassed to display the structure of this database, but I take a little comfort in the fact that, even though I haven’t “fixed” it, I most certainly did not create it like this.

Here is a field list (the starred fields are the ones I want to clear, and everything not specifically defined is a text field of some length):

Chart #
Date of Birth (Date/Time)
Family Name
Given Name
Other Name
* PDF (Hyperlink)
* Date (Date/Time)
* Requestor
* Priority (Yes/No)
* Procedure
* Category
* Payor
* Bucket Notes
* Status Date (Date/Time)
* Status
* Status Note
* TAR #
* Submission Date (Date/Time)
* ICD-9
* CPTs
* Inpatient (Yes/No)
* TAR Status Date (Date/Time)
* TAR Status
* TAR Status Note
(2 more sets of the starred fields, named the same as above but appended with “(2)” and “(3)”. All 3 sets of event data are displayed on the form. With the database structured like this, I’ll be needing a total of 3 identical procedures, with each procedure targeting a different “set”.)

The way this database is used is that only the latest 3 events (the 3 sets mentioned above) are retained in each record. New events are captured by erasing the data in one of the existing sets and entering the new event’s data in that set. The database is typically open by 5 users at a time, but the users don’t seem to run into each other much.

The goal of this procedure is to enable a user to quickly clear a set in preparation for entering the new event. I’d like to have a button next to each set that does that.

Any help will be greatly appreciated.


这篇关于宏错误:“对象不包含自动化对象[database_name]”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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