Where are my "[Event Procedure]"s Going??

NoSmoke

Registered User.
Local time
Today, 12:35
Joined
Nov 10, 2012
Messages
99
I have a reoccurring problem with Text Box events seemingly randomly disappearing i.e. the "[Event Procedure]" text disappears from the control's property sheet (for a given action) but the underlying VBA remains. As a result, the specified event does not happen. To restore, all I have to do is click on the button with three dots (not sure what it is actually called), focus is moved to the existing code, the [Event Procedure] text reappears on the property sheet and the event now triggers properly.

I have been able to find no rhyme or reason why this is happening. Can anyone please suggest why this might be happening?

Thank you for any help with this...
 
I have noticed that this occurs if you cut and paste a control onto, or off of, a tab control page.

This is a design-time hazard though. I have never observed this failure in a system deployed to a client.
 
Some developers disable an event by wiping that property. Are you sure there is nothing like that in code you have repurposed from someone else?
 
I have noticed that this occurs if you cut and paste a control onto, or off of, a tab control page.

This is a design-time hazard though. I have never observed this failure in a system deployed to a client.

Mark, I think you may be correct - it only happens at design time. I have however tab control pages now but did not in past and IIRC, the problem still popped up occasionally. I have had user(s) complain that a feature is no longer working (the problem turning out to be as discussed here) but those instances could well have occurred during previous program mods (which are quite frequent in this case). I don't think however it is related to cutting and pasting a control - more probably with copying and pasting a control (which I do quite frequently).
 
Last edited:
Some developers disable an event by wiping that property. Are you sure there is nothing like that in code you have repurposed from someone else?

I used to have third party code that was used to change the background color of a text or combo control when it had focus and it modified the control properties. It however seemed to cause other issues (I would get weird unexplained "Return without GoSub" (or some such) error messages at form load time which would pop up randomly but could usually be corrected by a simple recompile. I removed the code entirely however when I discovered the same could be accomplished by a built-in Access function. I do have a few other third party routines but they do not change control properties.

I hope a solution can be found - it's not practical to retest every control event (and I have a lot of 'em) whenever a program change is made.
 
If you did not change the name of the control it should be ok once you close the form and reopen it.

Try to wipe it from the property sheet close and reopen.
 
If you did not change the name of the control it should be ok once you close the form and reopen it.

Try to wipe it from the property sheet close and reopen.

Tried that - the "[Event Procedure]" wasn't restored (unless I am misunderstanding what you want to be tried). It is however restored if the 3 dot button (what is the correct name for that button anyhow?) is clicked as in my original post.
 
Tried that - the "[Event Procedure]" wasn't restored (unless I am misunderstanding what you want to be tried). It is however restored if the 3 dot button (what is the correct name for that button anyhow?) is clicked as in my original post.
Never had this problem
But I'm not using tabs, so it might be what causing the problem.
 
Have you importing all the objects to a new database?
 
I hope a solution can be found - it's not practical to retest every control event (and I have a lot of 'em) whenever a program change is made.

The ultimate kludge:

Write the properties On Load. This could be hard coded which would obviously be a lot of work.

However it could be done with a generic procedure that parses any Access Object Module and determines which control events need to be nominated.


Generally speaking, of course this is silly and I said it from academic interest.

However if I had a big project and I could not cure the problem I would probably resort to writing it one night rather than laying awake worrying about what else I could do.
 
Never had this problem
But I'm not using tabs, so it might be what causing the problem.

May be but don't think so as I have had this problem b/f I added tabs to the form.
 
Have you importing all the objects to a new database?

Funny you should mention that as I had to do that a few years ago, via text files, to solve another strange problem. That difficulty may have occurred, so I was told, from the conversion of the database from an older version of Access to Access 2010. Maybe I'll have to try that again (it would be a big job if all objects had to be converted & imported unless there is some way of automating it) but it would be nice to know the specific cause of the problem...
 
Have you got Auto Name correct turn on in 2010 ? - it will give you all sorts of weirdness, turn it off!
 
Have you got Auto Name correct turn on in 2010 ? - it will give you all sorts of weirdness, turn it off!

I don't believe so but I'll check it when (or whenever) it finishes exporting the dbase to a text file (it's been going about 1/2 hour now and the little wheel keeps on turning). I kind of expected the export function would let you specify which object to export, which it did not, so it looks like it's exporting the whole thing(?).
 
Gr-r-reat - the export just errored out on insufficient HD space. It did create a text file but the file size is 50 GB! (which is about how much free space existed before the export began). I had no idea my database was so large :) (it's actually BTW about 6 MB in .accdb form).

So much for that idea. Maybe I'll try to open the file to see why it's so freakin' large.
 
All I do is this.

Edit the event's function name to have a 2 or X at the end.
Double click on the controls event field to recreate it and then copy the old code into the new function.

Works every time for me.
 
Sorry, had a brain fart. What I really needed to do was run a SaveAsText (for the form in question) followed by LoadFromText in the Immediate Window. This will supposedly regen the form and flush out any corruption that may have crept in. Anyhow, the procedure completed as expected - will have to wait and see I guess if it did any good, in absence of any other solution.
 
All I do is this.

Edit the event's function name to have a 2 or X at the end.
Double click on the controls event field to recreate it and then copy the old code into the new function.

Works every time for me.

Thanks Dan, but do you mean it fixes the event's problem for good or just restores the event that one time?
 
Have you got Auto Name correct turn on in 2010 ? - it will give you all sorts of weirdness, turn it off!

No, it's turned off. I did though google it to find out what sort of problems it might cause and was surprised there are so many. You would think MS would either cure this thing or remove it.

Anyhow, and sort of related, I had previously tried to run some VBA code which choked on one of my table field names, apparently because it had a space in it (I know that's not supposed to be done but didn't know any better at the time so there it stayed). So, I removed the space from the name and tried to find all instances of it in other objects but kept getting errors so finally gave up looking. The googling I had done earlier however made reference to an Add-in called V-Tools which has a search & replace feature that worked very nicely in finding all instances to that modified name. It seems to provide the features of Auto Correct Name (and other options) w/o the problems.
 

Users who are viewing this thread

Back
Top Bottom