Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Annoying Bug - How do I get rid of this stupid error message? 1

Status
Not open for further replies.

idbr

MIS
May 1, 2003
247
GB
Hi All,

I am new to A97, having done most of my work on 2000. 97 has an annoying glitch:

Whenever I change code that runs from a form and then switch back to form view, when I try to run the code again I get the following error:

The expression On Click you entered as the event property setting produced the folllowing error: Only comments may appear after the End Sub, End Function or End Property.

blah blah....

Closing the form and opening it again stops it.

I'm hoping this is a well known issue and that someone can tell me how to stop it? I'm on NT4 btw.

Thanks, Iain Robertson
 
I have only ever come across that when I've pasted some code from one place to another and I've ended up with a pair of End Sub ( or End Function ) statements one after the other.

I can only suggest you look very carefully at the code to see if you have a typo in there.

Comment out all of your On error Goto statements ( in the Form AND any global module routines that the form calls )

Then do it again and Access Debug should take you directly to the offending line - if you haven't disabled Break Into Code.



'ope-that-'elps

G LS
accessaceNOJUNK@valleyalley.co.uk
Remove the NOJUNK to use.
 
I'm afraid not mr Smudge, it doesn't matter where the code is running from or where it's called from. Basically it happens whatever I change and whenever I change it - down to single characters - and even if the code is perfect (which it of course always is ;))!

So, the error message isn't in my view being triggered by an actual error, especially considering I never put anything after an End Sub - what wuld be the point?

Grrrrrrrrr!

BTW I don't know if this helps anyone but I run Access as a distributed application. Don't know if this matters?
 
I have this same problem an a daily basis, and no matter how many times I get the error I always forget I have to close and reopen the form before re-executing the code. I have yet to find a solution, so keep us informed if you find one.

Thanks,

BAKEMAN [pimp]
 
Okay idbr - you've got my interest. If Bakeman is having trouble as well, then .. ..

ZIP up a sample db that exhibits the problem ( Not too large please ) and I'll have a look at it here.

If I do come up with a solution I'll post something back on this thread for the benefit of all.



'ope-it'll-'elp



G LS
accessaceNOJUNK@valleyalley.co.uk
Remove the NOJUNK to use.
 
Did you try to compile your code? That should bring up where the problem lies, if there is one that exists.

To compile the code:
alt + F11
Select debug from the toolbar. Then select compile. If there is a code error like the one you are mentioning, this should help.



Mark P.

Bleh
 
A97 does not do good housekeeping. When you reopen the form it does not know you have changed the code. Try a DoCmd.Requery on the "On open event.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top