|
-
Aug 6th, 2015, 10:19 AM
#1
MSACCESS - Cant Delete Object while open
I have been trying to close a form, then delete it.. but it seems to not want to close
The object is to import an updated version of the form...
So I have an Update Button which calls another form..
In the form load of "update" form
Code:
DoEvents
DoCmd.Close acForm, "Main"
While (sysCmd(acSysCmdGetObjectState, acForm, "Main")<>0)
DoEvents
Wend
Docmd.DeleteObject acForm, "Main"
Always says "Cannot delete while open"
even though it says its closed. Even if I wait with code pause.. says its open
Application.CurrentProjects.ALlForms("Main").IsLoaded is true even though syscmd says its closed...
Help!
I tired doing the update in a Module as well.. still says the form is open
I need to close the form.. delete it... import a new version.. and re-open it
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Aug 11th, 2015, 05:46 PM
#2
Re: MSACCESS - Cant Delete Object while open
I think you need to unload it...
But why are you doing that?
The Deleting I mean, in code ?
Are you just updating forms?
If so, perhaps you should consider an ms access loader that chooses the latest version of your mdb to run... If you are on a shared network. Copy that file to the local drive and run.
Then you rename the old one and put the new one in with the old name. Next time the launcher is run it copies the new file instead... saves all the importing, deleting in code etc...
Feeling like a fly on the inside of a closed window (Thunk!)
If I post a lot, it is because I am bored at work! ;D Or stuck...
* Anything I post can be only my opinion. Advice etc is up to you to persue...
-
Aug 12th, 2015, 10:26 PM
#3
Re: MSACCESS - Cant Delete Object while open
Each user has a local copy that they can create queries etc... I cant replace the entire DB or they will lose everything. Each copy pulls from shared base DB ... the main data tables will import, and I want the form to import (but only when they are told to do so)
I have created a second form that opens.. then you click a button to update. I just didnt want to do it that way
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|