Easily corrupted forms when altering

FuzMic

DataBase Tinker
Local time
Today, 07:39
Joined
Sep 13, 2006
Messages
744
Hi members

I have met this many times; whenever i alter an old form, after saving it, it can't be opened. On trying to, it report that is it short of memory to open. This is not true as there is ample memory.

To avoid this i make just a few changes, save it first before i do another few changes. It is particularly prone to corruption if i change object type from one to another eg text to combo.

Once corrupted, nothing can be done but start from a good saved copy. Repair compact will do nothing.

Also if i make a COPY OF THE BAD FORM, this copy can NEVER BE DELETD deleted at all.

Please share your experience, thank you.
 
try creating new DB and import all object there.
it is always better to start from scratch than editing a db that was created from older version of access.
 
Compacting recovers unused space but has no effect on corrupted code which it sounds like you have.

If you have any corrupted objects, these will probably not be imported into a new blank database so you may have missing objects. However if they are all imported, that can sometimes transfer the issues as well.

I would first suggest decompiling which removes any corrupt code.
The sequence should be backup, decompile then recompile then compact.

For more info see http://www.fmsinc.com/microsoftaccess/Performance/Decompile.asp

Also check 'Require variable declaration' is ticked in vbe options and that you have Option Explicit as the second line in all code modules - normally after Option Compare Database. Then run Debug...Compile
 
Does the form concerned have an Active X component on it by any chance?

I used to suffer with the Active X Tree view component regularly going pear shaped on a number of forms. In the end I created a form with just the Treeview control on it in a working state, and saved that as a backup in the database.

Whenever it decided life was a bit much for it and headed west, I simply deleted the corrupt one compacted and repaired and then pasted my good copy back. Right royal pain in the backside, but at least I knew what it was.
 
Thank you guys for sharing. There is no activex and the decompile can't remove or resolve the corruption
 
Easy Fix
1. Decompile Old db as suggested
2. Create New Db as suggested
3. Import tables into new DB and compact and repair
4. Import queries (do this separately to avoid auto name updates)
5. Import everything else except the bad form
Save the bad form as a text file like so (substitute your names)
Code:
Public Sub SaveForm()
  Dim path As String
  path = CurDir
  Application.SaveAsText acForm, "Employees", path & "\Employees.txt"
End Sub
6. Import bad form from the text file like so
Code:
Public Sub LoadForm()
  Dim path As String
  path = CurDir
  Application.LoadFromText acForm, "Employees", path & "\Employees.txt"
End Sub
7. Compile your code
 
One thing that may be happening is that you have exceeded the 754 controls on a form during its lifetime. That does not mean you have 754 controls, it includes all added and deleted. I am not sure where that is tracked and not not sure if decompiling or compacting clears out that buffer. If you do a lot of cut and paste you can exceed that limit.
 
And turn OFF NameAutoCorrect ! This is a known cause of corruption.
 
And turn OFF NameAutoCorrect ! This is a known cause of corruption
Yes, if you add that to step 1 then you can likely import all non corrupted objects at one time without problem. I still fee l safer to bring the tables in first then the queries then all the other objects, but that may be overkill.
 
and not not sure if decompiling or compacting clears out that buffer.
it doesn't. Instead copy and paste controls to a new form - you'll need to copy/paste the code separately
 
Instead copy and paste controls to a new form - you'll need to copy/paste the code separately
I would feel safer exporting to text and loading from text. Just to be safe.
 
Great to hear so many new things. Thank you
 

Users who are viewing this thread

Back
Top Bottom