Can't track down error (1 Viewer)

ryetee

Registered User.
Local time
Today, 02:35
Joined
Jul 30, 2013
Messages
952
I'm getting a run time error 459, object or class does not support the set of events. This is when I double click on a field to trigger the double clock event.
If I click debug the program closes and when I reopen get the same cycle of events. If I click end try the double click again it works but I get an error message on the next form where I double click another control . This appears to be the same error message but in a different format

The expression on dbl click you entered as the event property setting produced the following error object or class does not support the set of events. There's a bit more text to follow.

If I put a break in the code where I think it's screwing up then I get the break and when I continue everything is fine and everything appears to work OK. If I close the program and reopen I get the same errors.

Any ideas where to start with a problem like this?
 

isladogs

MVP / VIP
Local time
Today, 02:35
Joined
Jan 14, 2017
Messages
18,261
With such a general outline, all I can do is suggest general approaches

Step through the code line by line.
Consider use of watch and/or locals window to examine what is happening
Add effective error handling

Good luck
 

ryetee

Registered User.
Local time
Today, 02:35
Joined
Jul 30, 2013
Messages
952
With such a general outline, all I can do is suggest general approaches

Step through the code line by line.
Consider use of watch and/or locals window to examine what is happening
Add effective error handling

Good luck

It's general because if I step through the code I don't get the error unless I close down access and restart without any breaks.

I was just in the process of looking what I need to decompile (I'm on a new laptop and have forgotten) but decide to do a compile database. Problem has now gone away.

This is worrying. Is this a quirk of access - ie run at your peril if you haven't compiled or is it something more sinister!!
 

isladogs

MVP / VIP
Local time
Today, 02:35
Joined
Jan 14, 2017
Messages
18,261
You should ALWAYS compile your code before distributing.
Do you require variable declaration in all modules.
Does Option Explicit exist in all code modules?

From your second post, it may be that your procedures are not always allowing time for the previous action to complete before starting the next task.
If so, the problem would indeed go away if you step through the code

Adding the line DoEvents at appropriate places in your code should fix that issue... though of course code will run slightly slower than before
 

ryetee

Registered User.
Local time
Today, 02:35
Joined
Jul 30, 2013
Messages
952
You should ALWAYS compile your code before distributing.
Do you require variable declaration in all modules.
Does Option Explicit exist in all code modules?

From your second post, it may be that your procedures are not always allowing time for the previous action to complete before starting the next task.
If so, the problem would indeed go away if you step through the code

Adding the line DoEvents at appropriate places in your code should fix that issue... though of course code will run slightly slower than before

Not sure what you mean by "Do you require variable declaration in all modules."

I have to declare all variables in each module if that's what you mean by "Does Option Explicit exist in all code modules?". I've done nothing specific to do this as far as I know!

Yeah and thanks for the doevents reminder. Not sure I need it though.
 

MajP

You've got your good things, and you've got mine.
Local time
Yesterday, 21:35
Joined
May 21, 2018
Messages
8,584
In the VBE under Tools>Options>Editor Tab
There is the setting "Require Variable Declaration"
If you have that set (which it sounds like you do) then at the top of every code module you get the line "Option Explicit".
This means you have to declare all variables (it is kind of insane that they would let you do otherwise). I do not believe this is the default setting, but it sounds like you have it set correctly.

Your problems sounds like a compile issue and not something in your code. Doing a decompile was most likely the exact correct thing to do. If you google this error it is often a reference issue, installation issue, or compile issue.
 

isladogs

MVP / VIP
Local time
Today, 02:35
Joined
Jan 14, 2017
Messages
18,261
You should always declare all variables used explicitly to ensure there are no compilation errors.
To do so, open the VBE, click Tools...Options then tick 'Require Variable Declaration'. I always do that when I create any new database.
That will add the line 'Option Explicit' to all new code modules.
Next you need to add that as the second line in all existing code modules immediately after the Option Compare Database line.
Finally you need to compile your database and fix each error that it picks up. You may find there are no compile errors but it is likely there will be a lot from what you said. Continue till all are fixed

Once you have done that your database should run successfully o other machines ...unless there are VBA reference issues or 'bitness' issues
 

ryetee

Registered User.
Local time
Today, 02:35
Joined
Jul 30, 2013
Messages
952
Thanks Maj and Isla.
Funnily enough I didn't have the option ticked (I do now).
However I do have option explicit in every module or it at least looks that way!!
 

Users who are viewing this thread

Top Bottom