PDA

View Full Version : Error when Quiting Access 2010 program



DBinPhilly
08-24-2011, 06:14 AM
A program that I developed originally in Access 97 and migrated through Access 2000 and Access 2003 has developed a bug using Access 2010.

There is a sign on screen named "UserSignOn" that I also use as a repository for variables that are used in various programs --- for example I pass SQL statements with variables to fields on the "UserSignOn" screen and use those fields as the record sources for certain other forms and reports.

When I execute DoCmd.Quit from anywhere in the database except the "UserSignOn" screen (or even click the "X" in the upper right to close the database), I get the following error message:

programname Cannot Find the referenced form "UserSignOn"

I might note that the error message appears even when I haven't used any of the references loaded in the "UserSignOn" screen. And the "UserSignOn" screen remains open at all times until the program closes.

Just by responding to the error with "End" the program closes, but it is annoying for my users. Any ideas?

HiTechCoach
08-25-2011, 09:03 AM
When helping several clients migrate their Access 200 and 2003 databases to 2007 I ran into the same issues. Access 2010 is still to buggy for my to support. I have recommends to all my clients to not use it yet. We are waiting on SP2 or fixes to SP1. In my testing I have seen the same issues with migration to 2010 that I have with Access 2007.

The best I can tell is that Access 2007 was a major rewrite of the application to use the be ACE database engine. This is carried forward to Access 2010. Things do work different in Access 2007/2010. For example Events don't always fire in the same sequence as the did in prior versions. Sometimes this is actually a fix to bugs in prior versions. The problem is your workarounds in older version will no longer work correctly in 2007/2010.

From what you have described it sounds like the order of events to close objects automatically are causing the issue. They could be closing in a different order.

I find it best to have a single exit point. I would not have Docmd.Quit in more than one place.

I use a main menu/switchboard form that stay open all teh tme. I use this form as tehd fiorst form that opens and the last one to close. It also uses hideden text boxes to store data like you have on your form "UserSignOn". Since this is the first form to open and the last one to close any form reference to it will always work. The order the other objects close will not matter.