dbTalk Databases Forums  

VBE opens up for no good reason when the program is used

comp.databases.ms-access comp.databases.ms-access


Discuss VBE opens up for no good reason when the program is used in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Bob
 
Posts: n/a

Default VBE opens up for no good reason when the program is used - 08-17-2010 , 11:21 AM






I have this problem that really upsets my users. We are using Access
2007. The Access program was written in Access 2003 with an mdb
extension. The tables are in a second linked Access 2003 file with
the extension mdb. The two programs are in the same folder on the C:
drive. The program has about 20,000 lines of VBA code. I inherited
this program, but I have made numerous improvements to it.

The problem is that for no apparent reason, when using the program it
goes into the VB editor and stops. I tell the users to press F5. It
then continues to the end. There seems to be no error in the code. It
stops usually at the function or sub statement in the procedures.
there is no error message.

Does anyone know how I can stop this from happening or what causes it?

Reply With Quote
  #2  
Old   
Salad
 
Posts: n/a

Default Re: VBE opens up for no good reason when the program is used - 08-17-2010 , 11:42 AM






Bob wrote:

Quote:
I have this problem that really upsets my users. We are using Access
2007. The Access program was written in Access 2003 with an mdb
extension. The tables are in a second linked Access 2003 file with
the extension mdb. The two programs are in the same folder on the C:
drive. The program has about 20,000 lines of VBA code. I inherited
this program, but I have made numerous improvements to it.

The problem is that for no apparent reason, when using the program it
goes into the VB editor and stops. I tell the users to press F5. It
then continues to the end. There seems to be no error in the code. It
stops usually at the function or sub statement in the procedures.
there is no error message.

Does anyone know how I can stop this from happening or what causes it?
You might want to do a search for
DoCmd.OpenModule

Is it typically the same module? If so, seach for the module name if
the above doesn't help. Maybe the original code use using something
during debugging.

Reply With Quote
  #3  
Old   
Banana
 
Posts: n/a

Default Re: VBE opens up for no good reason when the program is used - 08-17-2010 , 02:52 PM



On 8/17/10 9:21 AM, Bob wrote:
Quote:
I have this problem that really upsets my users. We are using Access
2007. The Access program was written in Access 2003 with an mdb
extension. The tables are in a second linked Access 2003 file with
the extension mdb. The two programs are in the same folder on the C:
drive. The program has about 20,000 lines of VBA code. I inherited
this program, but I have made numerous improvements to it.

The problem is that for no apparent reason, when using the program it
goes into the VB editor and stops. I tell the users to press F5. It
then continues to the end. There seems to be no error in the code. It
stops usually at the function or sub statement in the procedures.
there is no error message.

Does anyone know how I can stop this from happening or what causes it?
Are you saying it behaves as if a breakpoint was set but there's no
breakpoint? If that is the case, it's easy to fix the phantom
breakpoint: On the offending line, cut out the line then delete that
line and paste it back in. Compile the code. That phantom breakpoint
will then disappear. It's also probably necessary to re-distribute the
file to your users so they don't have that problems anymore.

It can happen whenever one leaves the breakpoint but didn't clear it out
- though VBE is supposed to be able to automatically clean up all
breakpoints at say, shutdown, it always doesn't happen and thus the
phantom breakpoint.

HTH.

Reply With Quote
  #4  
Old   
David W. Fenton
 
Posts: n/a

Default Re: VBE opens up for no good reason when the program is used - 08-17-2010 , 04:26 PM



Banana <Banana (AT) Republic (DOT) com> wrote in
news:4C6AE877.7030200 (AT) Republic (DOT) com:

Quote:
It can happen whenever one leaves the breakpoint but didn't clear
it out - though VBE is supposed to be able to automatically clean
up all breakpoints at say, shutdown, it always doesn't happen and
thus the phantom breakpoint.
I had this happen recently, and did a decompile/recompile, then
cleared all breakpoints and saved the project, and that took care of
it. I didn't have to delete the line of code.

--
David W. Fenton http://www.dfenton.com/
contact via website only http://www.dfenton.com/DFA/

Reply With Quote
  #5  
Old   
Banana
 
Posts: n/a

Default Re: VBE opens up for no good reason when the program is used - 08-17-2010 , 05:28 PM



On 8/17/10 2:26 PM, David W. Fenton wrote:
Quote:
I had this happen recently, and did a decompile/recompile, then
cleared all breakpoints and saved the project, and that took care of
it. I didn't have to delete the line of code.
Well, deleting the line and re-pasting it back is sufficient (at least
it was for me) to do away with the phantom breakpoint and more
importantly, that does not require doing a decompile. As Michael Kaplan
has stated on his website, one should not use decompile as knee-jerk
reaction but rather as a last resort. Besides it's much quicker that way.

Reply With Quote
  #6  
Old   
David W. Fenton
 
Posts: n/a

Default Re: VBE opens up for no good reason when the program is used - 08-18-2010 , 12:24 PM



Banana <Banana (AT) Republic (DOT) com> wrote in
news:4C6B0D08.3030505 (AT) Republic (DOT) com:

Quote:
On 8/17/10 2:26 PM, David W. Fenton wrote:
I had this happen recently, and did a decompile/recompile, then
cleared all breakpoints and saved the project, and that took care
of it. I didn't have to delete the line of code.

Well, deleting the line and re-pasting it back is sufficient (at
least it was for me) to do away with the phantom breakpoint and
more importantly, that does not require doing a decompile. As
Michael Kaplan has stated on his website, one should not use
decompile as knee-jerk reaction but rather as a last resort.
Besides it's much quicker that way.
Well, to me, a phantom breakpoint indicates that there's a
discrepancy between the canonical code I see onscreen and the
compiled p-code (I'm assuming break points get stored somewhere in
the p-code or in between the canonical code and the p-code), so this
seems like exactly the type of problem decompile was designed to
fix.

I also think MichKa was way too cautious in his advice about
decompile, but I understand why, since most people needing it are
using bad coding practices that can make decompile dangerous (as in,
it will cause you to lose code that would otherwise remain intact if
you didn't decompile). Since I practice good coding practices, I
feel no danger in decompiling (and, of course, you should always
back up before a decompile).

The reason I don't think a change to the canonical code is
necessarily going to fix the phantom breakpoint without a decompile
is because while it would seem that any pointers to a particular
line would be lost if that line is deleted, I can't see there's any
guarantee that it would be. I mean, you're in a state where things
are not working the way they are supposed to, so assuming that
removing a line will actually fix the erroneous pointer seems
ill-advised. Discarding all the p-code and returning to the
canonical code by itself seems to me to be the most reliable way to
fix the problem.

And, contra MichKa, decompile is perfectly safe, particularly if you
back up your file beforehand. And if you lose code decompiling
because of a phantom breakpoint, that means your VBA project had
huge problems already, and the phantom breakpoint might very well
have been the canary in the coalmine. Not doing a decompile may mean
that you end up with much worse problems later on.

--
David W. Fenton http://www.dfenton.com/
contact via website only http://www.dfenton.com/DFA/

Reply With Quote
  #7  
Old   
Bob
 
Posts: n/a

Default Re: VBE opens up for no good reason when the program is used - 08-19-2010 , 02:26 PM



On Aug 17, 12:52*pm, Banana <Ban... (AT) Republic (DOT) com> wrote:
Quote:
On 8/17/10 9:21 AM, Bob wrote:

I have this problem that really upsets my users. *We are using Access
2007. *The Access program was written in Access 2003 with an mdb
extension. *The tables are in a second linked Access 2003 file with
the extension mdb. The two programs are in the same folder on the C:
drive. The program has about 20,000 lines of VBA code. I inherited
this program, but I have made numerous improvements to it.

The problem is that for no apparent reason, when using the program it
goes into the VB editor and stops. I tell the users to press F5. *It
then continues to the end. There seems to be no error in the code. It
stops usually at the function or sub statement in the procedures.
there is no error message.

Does anyone know how I can stop this from happening or what causes it?

Are you saying it behaves as if a breakpoint was set but there's no
breakpoint? If that is the case, it's easy to fix the phantom
breakpoint: On the offending line, cut out the line then delete that
line and paste it back in. Compile the code. That phantom breakpoint
will then disappear. It's also probably necessary to re-distribute the
file to your users so they don't have that problems anymore.

It can happen whenever one leaves the breakpoint but didn't clear it out
- though VBE is supposed to be able to automatically clean up all
breakpoints at say, shutdown, it always doesn't happen and thus the
phantom breakpoint.

HTH.

HTH,
Thanks. That is the problem. I use a lot of breaks when I back
engineer the VBA code in the applications. So I will be careful to
delete the breaks before I close. Also, the cut and re-paste works
well.

Most of my users are microbiologists. The program keeps track of all
the assays they do on the MSL spacecraft before it will be launched to
Mars in December 2011. Already it includes 20,000 petri dishes whose
colonies have been recorded. It generates barcodes for the petri
dishes. Then these are scanned and the colony counts typed in. I
have written another Excess program that does all of the statistical
analysis of the data for the report prior to launch. It's all fun! I
have grown into an avid fan of Access.

Reply With Quote
  #8  
Old   
Bob
 
Posts: n/a

Default Re: VBE opens up for no good reason when the program is used - 08-19-2010 , 02:27 PM



On Aug 17, 2:26*pm, "David W. Fenton" <NoEm... (AT) SeeSignature (DOT) invalid>
wrote:
Quote:
Banana <Ban... (AT) Republic (DOT) com> wrote innews:4C6AE877.7030200 (AT) Republic (DOT) com:

It can happen whenever one leaves the breakpoint but didn't clear
it out - though VBE is supposed to be able to automatically clean
up all breakpoints at say, shutdown, it always doesn't happen and
thus the phantom breakpoint.

I had this happen recently, and did a decompile/recompile, then
cleared all breakpoints and saved the project, and that took care of
it. I didn't have to delete the line of code.

--
David W. Fenton * * * * * * * * *http://www.dfenton.com/
contact via website only * *http://www.dfenton.com/DFA/
Bana, see my reply to HTH above.
Thanks.

Reply With Quote
  #9  
Old   
Banana
 
Posts: n/a

Default Re: VBE opens up for no good reason when the program is used - 08-19-2010 , 02:38 PM



On 8/19/10 12:26 PM, Bob wrote:
Quote:
HTH,
Thanks. That is the problem. I use a lot of breaks when I back
engineer the VBA code in the applications. So I will be careful to
delete the breaks before I close. Also, the cut and re-paste works
well.
Glad that fixed the issue.

Two more things that may be helpful:

1) I recalled just now that one easy way to create a phantom breakpoint
is to run the code with breakpoint set, then at runtime, edit the code
and continue. That kinds of screws up the project's state and for that
reason several developers prefer to avoid doing any editing of VBA when
in break mode. Similarly, they may choose to clear the "Compile on
Demand" checkbox which is checked by default.

2) David mentioned doing a decompile - Though I prefer to do it sparsely
as possible, doing a decompile before distributing a version, especially
when there has been major changes, seems to me a good idea to ensure
you've cleaned out all gunk left behind during the development. Even
better yet, consider distributing MDE even if you aren't concerned about
protecting your VBA code simply as a means to guarantee that your VBA
code doesn't get changed by accident by honest users and avoid other issues.

Finally -- HTH = "Hope that helped"

Best of luck!

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.