Code keeps breaking (1 Viewer)

mjdemaris

Working on it...
Local time
Today, 04:59
Joined
Jul 9, 2015
Messages
426
Hello, again!
For some reason Access has decided to break on one certain event: BeforeUpdate on some sub form. This just started a day or two ago. So I debugged, compiled, etc. That didn't work, so I deleted the code and pasted it back in. that seemed to work for about a day. Now the problem is back.

Any thoughts as to what is causing this?

thanks!
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 06:59
Joined
Feb 28, 2001
Messages
27,194
"Code started to break" - but how do you KNOW it broke? What is the visible symptom?

What version of Access?
Is it shared or private?
Is it split or unified?
Is there an external application such as Excel or Word involved?

Throw us a bone, here, MJ. Give us something to sink our teeth into.
 

mjdemaris

Working on it...
Local time
Today, 04:59
Joined
Jul 9, 2015
Messages
426
Ok, Doc, let's see what kind of bone I can find.

Broke/breaking - as in using a stop statment at the entry of the event sub routine, like a red code break for debugging.

Access 2016
not sure what you mean by private or shared...
split
no external application.

Does this have some meat to it?
 

moke123

AWF VIP
Local time
Today, 07:59
Joined
Jan 11, 2013
Messages
3,921
is it the same code / same form each time?
whats the code and on what line is it breaking?
is there an error message?
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 06:59
Joined
Feb 28, 2001
Messages
27,194
Broke/breaking - as in using a stop statment at the entry of the event sub routine, like a red code break for debugging.

You are telling us it does something like a breakpoint on entry to the BeforeUpdate event routine entry point.

Assuming you did NOT intentionally put a breakpoint in that context, if a debug window comes up you should be able to use the Locals window to look at the Err object to see Err.Number and Err.Description. Or you could use the Immediate window to use a Debug.Print for Err.Number and Err.Description, and that would probably be very helpful.

VBA doesn't just "stop" - it stops for a reason. Programming is deterministic and highly predictable. So most of the time you just sail through that point and nothing unusual happens. But when it stops at that entry point, my first guess would probably have been a bad parameter and you somehow have turned off warnings so you don't get an error message box to tell you the error. But then, this is an event routine, probably coded by a wizard, so won't contain a linkage error. The only parameter for the BeforeUpdate event is Cancel, which would be hard to mess up unintentionally if the event code was created by the appropriate wizard.

I didn't realize from your original description that you meant that your code breaks as in breakpoint. So many folks tell us their code breaks meaning some other type of error notification or event. Sorry I didn't catch your drift right away. Sometimes I'm denser than other times.
 

missinglinq

AWF VIP
Local time
Today, 07:59
Joined
Jun 20, 2003
Messages
6,423
If you're having trouble with specific code, and you apparently think you know the code involved ("I deleted the code and pasted it back...", then, as moke123 suggested, you need to post the code for us to look at.

Linq ;0)>
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 06:59
Joined
Feb 28, 2001
Messages
27,194
Thinking about it, deleting code and then restoring it has one certain effect. You WILL have to recompile the code. So the next question is, if you just go into the VBA window and make some trivial change to the code - like add a space and then save and then remove the space and save again - then compile, does it start working again?

If so, then something is somehow corrupting your compiled code and I've never seen that happen before without the database as a whole being corrupted in some way. This might be time to copy out everything to a new blank database.
 

mjdemaris

Working on it...
Local time
Today, 04:59
Joined
Jul 9, 2015
Messages
426
Thanks, CJ, was just going to post that thread today. And for this group here, I apologize for not letting you know that I also posted on another forum, as one of the members there advised me forum etiquette.
 

mjdemaris

Working on it...
Local time
Today, 04:59
Joined
Jul 9, 2015
Messages
426
Well, this problem has not been solved, as it came back, only "breaking" at a different location. See link above (CJLondon's post) for continued discussion.
 

Users who are viewing this thread

Top Bottom