PDA

View Full Version : Automation error in MS Access


jAdams816
Aug 11, 2006, 12:42 PM
Hi,

Please Help

I am working with an Access database that was developed using Office 97 and was converted to the 2002-2003 Access file format. On this one form there are 26 text boxes (representing yearly pay periods) and on the “On Lost Focus” event for each text box the person who developed it set it to run a macro (that person is since long gone). The macro simply calls a function to validate the data that was just entered in the text box.

When the On Lost Focus event triggers I get this error msg:

“You’ve 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.”

From what I can tell the process doesn’t even make it to the function before the error is triggered i.e. there is nothing wrong with the code in the function. The error is generated without the code ever executing. I tested this by placing a break at the beginning of the function and the process never reaches that break point when testing it just errors out.

Also when testing I changed the macro call to an Event Procedure and just called the function from the event with VBA. This seemed to work. To me it is silly to have to add an event procedure for each text box (26 of them) call this function and I can’t help thinking there has got to be a simple solution.

The only thing I can figure is that perhaps I need to add or change a Reference (under Tools – References) but if I am correct I can not figure out what Reference I need to change/add.

If anyone knows what the problem with this is and can point me in the right direction it would be greatly appreciated.

Thanking you in advance

J. Adams