Access VBA - CloseCurrentDatabase
I have a little app written in Access.
In function Main which is called by the autoexec macro I do some initialization before loading the main form.
Based on some conditions, a restart is sometimes required.
I call the CloseCurrentDatabase method to close the current database (I can't call quit becuase it doesn't save the changes to any options) and get an Action failed error.
this is a problem because the database window is showing after they close the error window.
Anyone knows why I'm getting this. I have another app and it's working perfectly.
Thanks,
Re: Access VBA - CloseCurrentDatabase
Could it be because that in this "problem" db your having errors that are causing yuo to re-open your db?
Re: Access VBA - CloseCurrentDatabase
No, I stepped through the code and the only line causing an error is the one calling the CloseCurrentDatabase function.
Re: Access VBA - CloseCurrentDatabase
Can you tell me more of what your doing that requires you to re-open your db?
Re: Access VBA - CloseCurrentDatabase
I'm not re-opening the db.
I found the problem.
the macro was calling the function this way:
=Main()
When it should have been calling it this way:
Main()
Thanks,