Set focus to another form and execute a command to close form a from there.
J
Main Topics
Browse All TopicsHi
I have a form A which upgrade the others forms, report and tables on a access database (2003), using transfertDatabase acimport from a "distribution database"
I try to upgrade the form A on itself
To do it , I start from Form A, close A, docmd.openForm B which import the new form A , called FormA_IMPORT , after I delete formA (docmd.delete), rename FormA_IMPORT into Form A, close Form B and docmd.openForm new Form A to continue the job.
Everything is oK but docmd.delete on Form A does not operate - err 2008 can't delete an Open Form
I try many things to close , docmd.close acform, a loop an form.collection - no result !
idea ??
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Thanks for answer
Nothing operate
The form A is really close when I break in form B - it is not open on the desk
But when I want delete It, I get error 2008
When I want to delete Form A directly in database windows, I get again same error 2008
That means FormA is still locked , seems Open ?
Note : in this soft, because I need transfert Forms, module and so on, prior the transfert, I open Break Mode and send password protection VB
Perhaps something in this way ?
I think we need to outline the order of operations.
Sounds like you need a Primary form that stays open during ALL operations and manages the copying and such from there.
I don't think what you're trying to do is hard...I just think its a timing issue and requires you to step back and rethink the management of when things happen.
Remember the rules when it comes to objects. You can't perform certain actions when you're not in focus, and you can't perform certain actions unless you're in focus.
build a step by step...and when you come to the correct order of events, the rest is easy.
J
Thanks
My primary form can't stay open during all opération because I need to substitute it with a new version
A this form is the sofware that manage all the update of tables and form of my application
Before, the onky way to do it was to go directly into the code , and paste the new code. It's become very heavy because the incresing numbre of my customer
So the idea was to put behing the main form, a little form (bis) , call by main form at the beginning of the process, what need only to substitute the main form
An the substitution was going like that :
1 - transfert import with form.name_IMPORT
2 - delete form.name
3 - rename form.anem_IMPORT to form.name
4 - give back the hand (in french donner la main) to the main form (new) so it can continue with other object.
The blocking problem is that I can't really close main Form and I don't understand why ?
The form is not still in database windows but it is open so cannot delete it.
If you have idea, I take
Thanks in advance
Patrick
Business Accounts
Answer for Membership
by: necritPosted on 2009-09-28 at 17:05:58ID: 25444719
Couple of suggestions
Can you put a breakpoint in at line 13 to see if there was an open form error with debug.print err.number?
Can you put in debug.print me.dirty to see if the form tries to create a record on load?
Can you see if maybe the form on import is missing a table dependency?