473,748 Members | 2,528 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Macro error: "The object doesn't contain the automation object [database_name]"

sueb
379 Contributor
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.
Apr 24 '10 #1
10 25943
ADezii
8,834 Recognized Expert Expert
@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.
Apr 24 '10 #2
robjens
37 New Member
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.

Expand|Select|Wrap|Line Numbers
  1. Private Sub Button1_Click()
  2.  
  3. me.txtField1 = ""
  4. me.txtField2 = ""
  5. etc
  6.  
  7. End Sub
  8.  
  9.  
Optionally you might need to save the current record depending on how your form is bound using

Expand|Select|Wrap|Line Numbers
  1. DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
Apr 24 '10 #3
sueb
379 Contributor
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.
Apr 26 '10 #4
ADezii
8,834 Recognized Expert Expert
@sueb
I was trying to figure out the easiest way to accomplish your Task, and this is what I came up with:
  1. For each Control on your Form that you may wish to have cleared, set its Tag Property to Clear. You can accomplish this by:
    • Right Click on the Control(s)
    • Select Properties
    • Select Other Tab
    • Tab will be the last Property listed
    • Enter Clear as the Value for this Property
  2. Execute the following code wherever you deem necessary:
    Expand|Select|Wrap|Line Numbers
    1. On Error Resume Next
    2.  
    3. Dim ctl As Control
    4.  
    5. For Each ctl In Me.Controls
    6.   If ctl.Tag = "Clear" Then
    7.     ctl.Value = Null
    8.   End If
    9. Next
Apr 26 '10 #5
sueb
379 Contributor
@ADezii
So in this example, I'm assuming that "Me" would be replaced by my database's name (or is that a keyword?). Also, as I mentioned earlier, the ways of Access are still murky to me, so, since it's already been made clear that I would NOT use a macro, would this be a module, that I would then attach to my form's button?
Apr 26 '10 #6
ADezii
8,834 Recognized Expert Expert
@sueb
  1. Me, in this case, would refer to the Form where the code is currently executing.
  2. The code could go in the Click() Event of a Command Button, among other places.
  3. Download the Attachment for a Visual to see how this can be done.
Attached Files
File Type: zip Clear Controls.zip (13.8 KB, 310 views)
Apr 26 '10 #7
sueb
379 Contributor
I think I'm getting closer. But now I'm getting an "Object Required" error message. Here's my module:

Private Sub CLEAR_IUR_1_Cli ck()
On Error GoTo Err_CLEAR_IUR_1 _Click

Dim ctl As Control

For Each ctl In frm_IURStatusNo tes.Controls
If ctl.Tag = "Clear" Then
ctl.Value = Null
End If
Next

Exit_CLEAR_IUR_ 1_Click:
Exit Sub

Err_CLEAR_IUR_1 _Click:
MsgBox Err.Description
Resume Exit_CLEAR_IUR_ 1_Click

End Sub


I added the exit and error handler because when I ran it without them, only some of the fields marked with "CLEAR" got cleared.
Apr 26 '10 #8
ADezii
8,834 Recognized Expert Expert
@sueb
Expand|Select|Wrap|Line Numbers
  1. For Each ctl In Me.Controls
Apr 26 '10 #9
sueb
379 Contributor
That seemed to do it! Apparently, I misunderstood what you meant about the "form on which I was working", but now it's all good! Thanks so extremely much!
Apr 26 '10 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

16
2453
by: Jim Hefferon | last post by:
Hello, I'm getting an error join-ing strings and wonder if someone can explain why the function is behaving this way? If I .join in a string that contains a high character then I get an ascii codec decoding error. (The code below illustrates.) Why doesn't it just concatenate? I'm building up a web page by stuffing an array and then doing "".join(r) at
1
7470
by: Kevin | last post by:
Help, I am running a pass through query to oracle from SQL server 2000 as follows; select * from openquery(nbsp, 'select * from FND_FLEX_VALUES') I have run this query through both DTS and the query analyzer and get the foloowing error;
0
2101
by: James Lavery | last post by:
Hi all, We've got a vb.net assembly (dll), which is exposing a COM interface so it can be called from our legacy VB6 application. When we call a particular method (which is designed to return true/false when finished), the method works fine (it is meant to store data in a database, and this part works), but we get the error: "The object invoked has disconnected from its clients" triggered in the VB6 calling application.
1
2018
by: Elie | last post by:
Hello I get this error when the code runs from the server as an .asp page or from a compiled dll. But When I log onto the server and run a vb program that executes the same code, it works fine. this works fine on a different web server as well. They are both running windows 2003.
5
15136
by: lds | last post by:
I am getting the following error: The "SendUsing" configuration value is invalid. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Runtime.InteropServices.COMException: The "SendUsing" configuration value is invalid.
1
3972
by: BillAtWork | last post by:
Hi, I'm trying to validate an XML document against an XSD schema and I receive the following error: ---------- MyCode.CreateValidRequest : System.Web.Services.Protocols.SoapException : Validation error: The element 'http://xmlns.somewhere.com/something:rDetail' cannot contain text. Expected 'http://xmlns.somewhere.com/something:AList'. An error occurred at , (1, 533). ----------
1
2583
by: BillAtWork | last post by:
Hi, I'm trying to validate an XML document against an XSD schema and I receive the following error: ---------- MyCode.CreateValidRequest : System.Web.Services.Protocols.SoapException : Validation error: The element 'http://xmlns.somewhere.com/something:rDetail' cannot contain text. Expected 'http://xmlns.somewhere.com/something:AList'. An error occurred at , (1, 533). ----------
2
11310
by: martin-g | last post by:
Hi. When the user opens the Excel file, which is at the same time used by my application, it stops calculations and throws an exception with such information: "The object invoked has disconnected from its clients". What can I do to resolve this? My application opens the source excel file using this statement: oRatelistWbk = AppExcel.Workbooks.Open( m_FilePath, Missing.Value, true, Missing.Value, Missing.Value,
12
17610
by: ilucks | last post by:
I converted Acc97 to Acc2003 and got this error "The command or action 'SaveRecord' isn't available now" when i tried to open one form"Add Info form", which has Save button. I checked "reference" in Tool to see DAO 3.6 object library setting, and it was right. How can i resolve this error? Thanks.
0
2356
by: PShark | last post by:
Hi I have a VB6 app that uses MAPI to send and receive emails. My users are able to use the app to send emails successfully, but when there are new emails in the mailbox, the program opens the email but then raises the following error: "Automation error – The object invoked has disconnected from its clients." The same program is installed on over 30 workstations which have roughly the same config Windows Xp and outlook 2003. The error is...
0
8832
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9381
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9332
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9254
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6078
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4608
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4879
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3316
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2217
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.