Closing Database Error

CanWest

Registered User.
Local time
Today, 15:35
Joined
Sep 15, 2006
Messages
272
Ok this is just bizarre.

I have a database that I created in Access 2003 some time ago.

I have ported everything to Access 2010. I started by importing everything in both the front end and back end into clean new .mdb files. I then had to make a few adjustments to to startup issues and custom menu issues. Nothing major.

On the main menu which is a form called frm_MainMenu I have a quit button which has a single line of code

Code:
    DoCmd.Quit

In access 2003 this works fine. In access 2010 I get the following error

Run-time error 2450
Microsoft Access can't find the referenced form frm_LogonStorage.

I don't get why it is even looking for it. The form is in the database and at the time the Quit button is pushed it is open.

Any ideas????
 
Try the below code instead:
Code:
Application.Quit
 
Try the below code instead:
Code:
Application.Quit

I am afraid this did exactly the same thing.

And unfortunately I am not able to debug the code because the database does actually closed.
 
Based on the error you are given there is some Code crawling around somewhere that is trying to reference the Form..

If I were you, I would use CTRL+F and type frm_LogonStorage search the Current Project not just the Current Module, search for every instance of the Form, see what it is exactly doing there.

DoCmd.Quit/Application.Quit either way should close the DB. That is not the problem you are having here. My stab in the dark would be some UNLOAD event is trying to close the Form explicitly or UPDATE something by referencing the controls..
 
If I were you, I would use CTRL+F and type frm_LogonStorage search the Current Project not just the Current Module, search for every instance of the Form, see what it is exactly doing there.

Thanks I will try this. The weird thing is this only happens if I open the db with Access 2010. In access 2003 it works perfectly.
 
I seem to recall someone quite recently experiencing a quirk/feature whereby some form Load event was run when quitting Access. Do as Paul suggested and find where your code wants to do something with that form. You could set up some global flag, whichm when quitting, would prevent the LAof-code trying to grab the missing form. (if my diagnosis is correct)
 
DoCmd.Quit/Application.Quit either way should close the DB. That is not the problem you are having here. My stab in the dark would be some UNLOAD event is trying to close the Form explicitly or UPDATE something by referencing the controls..

THANKYOU

I have some code that runs on the onOpen event. This same code was also on the onLoad, onCurrent and onActivate. This was the problem as one of these was trying to reference frm_LogonStorage after it had been closed.

Problem Solved
 

Users who are viewing this thread

Back
Top Bottom