Importing objects in new db fails partly

G

Goos van Beek

I have the following peculiar problem. When I import my database objects
into a new database there are some forms which are not imported complete.
The import completes without errors.
Those 'problem' forms are visible in the database window, and the VBA code
is also present. Only the actual form object is missing. It is not possible
to open the form, even not in the design mode.
When I import those forms again there are no problems and the forms can be
opened without problem.

Exporting the forms from the source database (with an add-in / VBA code)
causes no problem.

I use Access 2003 SP3.

Does this sounds familiar to anyone?
 
A

Allen Browne

I don't have any specific info on this, so it would be good to hear if
someone else does.

You're not using Visual Source Safe? That has problems with A2003 SP3.

If this applies to specific form(s) but generally not others, there's a
fairly good chance that the form is partially corrupt. You might try
rescuing the original database (i.e. the one you are copying from):

1. Make a backup copy of the MDB in case something goes wrong.

2. Make sure you have te Name AutoCorrect boxes unchecked under:
Tools | Options | General | Name AutoCorrect
Explanation of why:
http://allenbrowne.com/bug-03.html

3. Compact the database:
Tools | Database Utilities | Compact/Repair

4. Decompile by entering something like this at the command prompt while
Access is not running. It is all one line, and include the quotes:
"c:\Program Files\Microsoft office\office\msaccess.exe" /decompile
"c:\MyPath\MyDatabase.mdb"

5. Open the form's module, and copy all the code out to Notepad. Close the
module. In form design view, set the form's Has Module property to No.
Answer Yes to the confirmation dialog about losing the code. Save the form.

6. Compact the database again.

7. Export the suspect form to a text file, using the undocumented
SaveAsText. Something like this:
SaveAsText acForm, "Form1", "C:\Form1.txt"

8. Delete the suspect form.

9. Compact again.

10. Get Access to recreate the supsect from from the text file:
LoadFromText acForm, "Form1", "C:\Form1.txt"

11. Open the form's module, and paste in the text you saved at step 5.

12. Still in the code window, choose Compile from the Debug menu.

Now see if the form will import into your other database correctly.
 
G

Goos van Beek

Hi Allen.

Thanks for your effort!

For a few weeks I get memory errors and import errors as described while
importing objects in a new database. Its a fairly large FE database, it
migth have somthing to do with it, I don't know.

These are the steps I followed until now:

- Database was already compacted and repaired.
- I already tried the decompile switch without result.
- On this particular machine was VSS 6.0 installed. Uninstalling did not
solve the problem.
- I did copy the error forms without code, but some of those new forms
also caused an error.
- I *always* uncheck the Name AutoCorrect, . In all my applications I use
an 'InitApplication' script which sets/creates all nessecery
settings,properties and permissions.
This script also turns off the Name AutoCorrect. After all objects are
inmported, and thats where it goes wrong!

* Unchecking Name AutoCorrect in the newly created db before importing the
objects from the source db was the solution for my problems!

Thanks again!

Goos van Beek.
 
A

Allen Browne

Thanks for posting the solution.

Looks like another one goes down to Name AutoCorrupt.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top