Re: Mystery Access VB bug
From: Allen Browne (AllenBrowne_at_SeeSig.Invalid)
Date: 09/08/04
- Next message: Steve: "Cant save record!"
- Previous message: ColetteD: "RE: Restricting data updates on Subforms"
- In reply to: Sam Smith: "Mystery Access VB bug"
- Next in thread: anonymous_at_discussions.microsoft.com: "Re: Mystery Access VB bug"
- Reply: anonymous_at_discussions.microsoft.com: "Re: Mystery Access VB bug"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 8 Sep 2004 18:12:31 +0800
Hi Sam
I hope you get several replies, as this kind of thing is hard to diagnose.
>From your description, it sounds like your mdb is becoming partially
corrupt. The fact that the problem can be fixed by replacing the code with
identical code reinforces that view.
Access keeps 2 copies of your code: the text version (what you edit), and
the compiled version (what actually runs). While you are modifying forms and
their modules, it is quite common for Access to get these two out of sync,
and you then have a corruption.
IME, one of the things that triggers this corruption is editing the module
of a form in break mode. That is, you open a form (not design view). An
event is triggered. Your code runs, and hits a bug. You choose to Debug, and
are dropped into the VBA window with the problem line highlighted. At this
point, if you edit the code, Access has to create a temporary copy of the
form and the code (as it always does when you start an edit) so that it can
revert to the previous saved state if needed. So, it is now trying to juggle
four copies of the code: text and compiled of original and temporary, and
some of these are being created while some are running. Somewhere in this
process, it gets the copies confused.
Occassionally you can actually catch it out: even though you have altered
the text version of the code visible in your editing window, the Compile
option on the Debug window sometimes remains greyed out (assuming you were
fully compiled at this point), i.e. Access still thinks the project is
compiled, even when you have altered the code. Another indication is that it
can zip straight past a breakpoint without stopping. The compiled version it
is using is out of sync with the text version.
Once we realized what was going on, we made a conscious decision never to
edit in break mode, but to always switch the form to design view before
editing the module of the form. This was in Access 97, and our corruptions
during development dropped dramatically.
For other suggestions on preventint corruption, see:
http://members.iinet.net.au/~allenbrowne/ser-25.html
#2 and #3 do not apply to Access 97, but the other ideas may help.
-- Allen Browne - Microsoft MVP. Perth, Western Australia. Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "Sam Smith" <sam@itsoftworksnospam.com> wrote in message news:7e1601c49586$7ea14130$a601280a@phx.gbl... >I wonder if I am going insane. Across all recent versions > of Access I seem to have come across the following bug and > I just thought I would mention it to see if there is any > interest from MS to actually fix it. > > The weird bug: > > Every so often in forms coding I eventually get to a point > where I get an error in the same way as if I had a missing > reference but it has, in fact, nothing to do with that at > all except appears to be some sort of mystery internal > Access bug. The latest occurrence of this bug in detail: > > I have a form with a sub form. On the event on one of the > text boxes in the sub form I have some simple code which > activates when the text box is double-clicked. > > This is all working fine until the mystery internal bug > appears. > > In changing some code I decide to make one variable > public. This then seems to break the double-click code. If > I remove the new variable and put the code back to how it > was the bug is still there. Every time I double click on > the text box in the subform I get the usual error that I > would get if I had a missing reference. > > But it gets weirder (and more annoying). > > If I import over the SAME CODE (identical in everyway) > from a backup - it works fine. If I try to run the old > code then it brings up the reference error. 2 pieces of > code that are identical to the Access developer but > internally must look different to Access. > > Now, there is obviously a lot going on behind the scenes > in Access that us developers are not privy to and it is > clearly that something in the internal code of Access > itself is screwy. I have used Access since '97 and have > come across this weird reference bug in different guises > off and on since then. It doesn't happen very often - > perhaps once every 6 months. I do use Access every day so > perhaps only a few of us will trigger this. > > Although I keep getting around it I just thought that it > might be nice if MS could be made aware of it and release > a patch - because when it occurs it is a real pain to > debug as it is not actually anything a normal developer > can fix as it is internal to Access. > > If this could be fixed then it would make Access even more > perfect! :) > > --- > Sam
- Next message: Steve: "Cant save record!"
- Previous message: ColetteD: "RE: Restricting data updates on Subforms"
- In reply to: Sam Smith: "Mystery Access VB bug"
- Next in thread: anonymous_at_discussions.microsoft.com: "Re: Mystery Access VB bug"
- Reply: anonymous_at_discussions.microsoft.com: "Re: Mystery Access VB bug"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|