Object or class does not support the set of events?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello all,

I hope someone could share some insight on this strange issue I've been
having. I've been building a database for about three weeks now and I have
so far had no problems with it (on MY system). My boss at work opened the
database up and tried to open the form. He got this error:

-----
"The expression "On Load" you entered as the event property setting produced
the following error: Object or class does not support the set of events.
*The expression may not result in the name of a macro, the name of a
user-defined function, or [Event Procedure]. *There may have been an error
evaluating the function, event, or macro."
-----

For one thing, I don't see how it couldn't work on his, but it does on mine.
I tried it on a couple other systems and they had the same problems as well.
All tested systems use Access XP with Windows 2000 SP4 and are all part of
our corporate Novell network (they're all Dell OptiPlex GX270's--should be
the exact same systems). I checked the References in VBA and none of them
were missing on the systems getting the errors. The other systems got
similar errors in other forms for Expression 'On Click', 'On
MouseMove'...anything. I even tried to trap the errors using the Form_Error
subroutine but it came up with the same error specified above with
"Expression 'On Error'".

Here's how I "temporarily" fixed it. I just went into VBA and cut the
Form_Load sub out of my code and pasted it back in. I changed NOTHING
physically and then everything worked fine, however, after a while the errors
started happening again. I didn't know until trying someone else's system
because, like I said, I don't get the errors on mine. I've scoured through
the online help and discussion groups and haven't been able to find any clues
towards debugging this issue.

Before making this too long of a question, has anyone run into this type of
problem before? I can elaborate as needed. It is acting like it can't find
the VBA code right away.

Best regards,
Bill K
 
Sounds as if this is a "mild" case of database corruption. A "really acute"
case would prevent you opening the database at all.

If it is, as may well be the case, single-user, since it is under
development, that eliminates a lot of possible causes. Perhaps you should
use the semi-undocumented /DECOMPILE command line feature, then open the
database and compile it. Current versions compile all modules; on older
versions you may have to choose "compile and save all modules" from the
menu.

Larry Linson
Microsoft Access MVP
 
Thanks for the decompile tip--I tried it out and it temporarily solved my
problem. In a couple days, the same errors described at first came back.
Strange again, I didn't even know they were happening until someone on a
different system tried to access the database. They happened even if they
were the only ones in the database.

I went ahead and decompiled again after getting the same message (and by
decompiling I'm including backing up, compacting and repair, doing the
decompile, and compiling the code again.) The problem went away after this.
Sure enough, within the day the errors came back (not on my system though.)

After this, I proceeded to create a brand new database and import the
objects back in (and ensuring the name auto-correct was turned off as well.)
I thought I had the problem licked, but sure enough after a while the same
"object or class does not support the set of events" and "The expression on
click...", etc. errors showed up again. It seems like my code should be FINE
considering a decompile/recompile catches no errors and gives me a perfectly
working program. Any ideas?

Thanks for your help,
Bill

Larry Linson said:
Sounds as if this is a "mild" case of database corruption. A "really acute"
case would prevent you opening the database at all.

If it is, as may well be the case, single-user, since it is under
development, that eliminates a lot of possible causes. Perhaps you should
use the semi-undocumented /DECOMPILE command line feature, then open the
database and compile it. Current versions compile all modules; on older
versions you may have to choose "compile and save all modules" from the
menu.

Larry Linson
Microsoft Access MVP

Bill K said:
Hello all,

I hope someone could share some insight on this strange issue I've been
having. I've been building a database for about three weeks now and I have
so far had no problems with it (on MY system). My boss at work opened the
database up and tried to open the form. He got this error:

-----
"The expression "On Load" you entered as the event property setting produced
the following error: Object or class does not support the set of events.
*The expression may not result in the name of a macro, the name of a
user-defined function, or [Event Procedure]. *There may have been an error
evaluating the function, event, or macro."
-----

For one thing, I don't see how it couldn't work on his, but it does on mine.
I tried it on a couple other systems and they had the same problems as well.
All tested systems use Access XP with Windows 2000 SP4 and are all part of
our corporate Novell network (they're all Dell OptiPlex GX270's--should be
the exact same systems). I checked the References in VBA and none of them
were missing on the systems getting the errors. The other systems got
similar errors in other forms for Expression 'On Click', 'On
MouseMove'...anything. I even tried to trap the errors using the Form_Error
subroutine but it came up with the same error specified above with
"Expression 'On Error'".

Here's how I "temporarily" fixed it. I just went into VBA and cut the
Form_Load sub out of my code and pasted it back in. I changed NOTHING
physically and then everything worked fine, however, after a while the errors
started happening again. I didn't know until trying someone else's system
because, like I said, I don't get the errors on mine. I've scoured through
the online help and discussion groups and haven't been able to find any clues
towards debugging this issue.

Before making this too long of a question, has anyone run into this type of
problem before? I can elaborate as needed. It is acting like it can't find
the VBA code right away.

Best regards,
Bill K
 
Hello everyone,

I still haven't been able to figure this error out. It seems like nothing
I've tried has made the problem completely go away--it just keeps coming
back. It will be fine for about a day or so but after some database work,
the "object or class does not support the set of events" error keeps
surfacing when trying to click a button or update a combo box (see the first
post). I've been building this database for a company as a contractor and
the reoccuring error is frustrating for everyone and I don't know what more
to do! I've scoured this entire newsgroup, tried various solutions, and
haven't found anything yet that has worked.

Any help would be greatly appreciated! We can't go live with the database
until the error is fixed and if it's not, then it's 2 months of work down the
drain.

Many thanks,
Bill K
 
I am also working on a Microsoft Access database and receiving this same odd error. Not too much out here for clues as to what's wrong. I am using Windows XP, Access 2000. In my case it's rather simple. I have a table that I can interact with manually and with forms, but when I try to place an event procedure on a form field, I get the error you mention at runtime.

The event procedure can even be EMPTY, with no instructions. I don't see how database corruption can account for this, but then who knows. The application works perfectly, but if I try to put any kind of event procedure on any kind of keyboard event, bam!

I have not gone through to figure out if ANY event will cause this error, or if this particular event will crash on ANY form field, but I am running out of other creative debugging ideas and will soon get around to trying that. If I make any progress I will be quick to post the solution. Short of that I will post any ideas or tips I may run across.

Good luck with your debugging.

Brian Herbert Withun
Carleton, MI
 
After searching for clues and trying everything I could, I think I managed to
stop the errors from occuring. The decompile tip was very beneficial--big
thanks to Larry Linson on that one. Unfortunately, my problem was more
involved but while finding the syntax for the decompile, I came across some
tips on finding corruption. Recreating the database and importing didn't
solve the problem, but what did was the SaveAsText option. Here is an
excerpt from a post by Allen Browne regarding this:
----
"Something else you could try with the suspect objects is to save them as
text, and then import them from the text file. For example, to save Form1
from the corrupted database:
SaveAsText acForm, "Form1", "C:\form1.txt"
Then in the new database:
LoadFromText acForm, "Form1", "C:\form1.txt"
----

That process should give you a database where the name-autocorrect errors
are gone, the indexes are repaired, inconsistencies between the text- and
compiled-versions of the code are fixed, the reference ambiguities are
resolved, and know each step is okay before moving on to the next one."

Also, searching the newsgroups for "corrupt" or "corruption" will give you
more information on these issues. Someone correct me if I'm wrong, but it
appears that the tables and forms in Access somehow lose their "link" with
the underlying VB code and try to refer to event procedures you may have
removed in the past (or not have implemented at all.)

SaveAsText/LoadFromText looks like a last-resort solution but it may be the
one thing that fixes your database after trying everything else. Good luck!

Bill K
 
Object or class does not support the set of events

Have the same nagging problem.
Access 2007, Vista.
I worked on an imported-old-Access-version in 2007.
In the new DB everything works fine, BUT:
When splitting the DB and creating a Front End DB - the hell started !
Can't find a way to avoid the "Object or class does not support the set of events" message and the main form does not open.
When replacing the form's VB OnLoad [Expression procedure] to a macro, and creating a new F.E. DB - it does. but that is no way.....

Please an (easy...) solution.
Thanks
adh
 
Last edited:
that dratted button

I too am creating a database - Windows Vista, Access 2007. I have a row of buttons one of which is set to run a macro. It worked fine for several months, then suddenly started giving me a message along the lines of "no return " and "gosub". Every time I opened the database, I had to remove the button and re-install it; it would then work brilliantly UNTIL I closed the file and re-opened it. Today, the message is "Object or class does not support the set of events". The macro has not changed, the button has not changed, the OnClick event has not changed, only the message has changed BUT the button still does not work - removed it, recreated it, and of course it now works - but for how long

Aileen
 
Just wanted to post this here in case someone else comes across this thread with the same problem:

I was getting that same OnLoad error, and it was due to the field types on two items I had just added to the form. Apparently, it doesn't like it when you try to lock editing on a memo field. (I've found that data type to be a little wonky in other areas, too, when you're writing more complex VBA.)

Anyway, I deleted the fields from the form in design view, went back to the table and changed their data types to text, re-added them to the form, and everything works fine now.

I'm using Windows XP Pro, Access 2007.
 
Ooh... actually, no. That made it work for a while, but the error popped up again today. Looks like I'll be trying SaveAsText/LoadFromText.
 
Back
Top