X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
   Closed TopicStart new topic
> Saving corrupt or broken database objects    
post Jan 7 2004, 01:04 PM

Retired Moderator
Posts: 8,589
Joined: 19-December 02
From: Lansing, MI

This uses a hidden undocumented feature of access. What it does it send the object to a text file. When you bring the object back in it often fixes corruption. It also removes from the count of controls in a form or report that have been deleted. This fix is not guaranteed to help but has worked very well for me. Use this for all forms, queries, reports, modules in the problematic database.

In the immediate window type this code, replace Objectname with the objects actual name
application.saveastext acForm,"Objectname","C:\Windows\Desktop\Objectname.txt"

then use this code to bring the object back in
application.loadfromtext acForm,"Objectname","C:\Windows\Desktop\Objectname.txt"

acForm must be changed to acQuery, acReport, or acModule to correspond with the object type you are sending to text. The location can be anywhere, I often use my desktop so I can delete the file once i have brought it back into access without having to open windows explorer.

I hope this will be as useful for you as it has for me.


Added 10.6.2009 due to a PM I got:
Sorry to bother you. I saw your post on how to export an Access object, such as a form, to text and then import it back in to remove corruption. I have a form that has a tab control and a bunch of subforms. I was working in the design adding an image or line or fixing something cosmetic. I go to save and get a message that there is not enough memory to perform the operation. Access crashes and then I can't open that form any more. I tried the immediate window suggestion and I get a message that says Run-time error '2001': You canceled the previous operation. Would you have any thoughts, please? I appreciate that this is just a trick you found and you said it doesn't always work. I have a backup of my application with an earlier copy of the form. The catch is that while the form opens in the backup copy, when I import it into my current database, it won't open. Thanks.

The reply is:
Not that this is helpful at all as you're completely out of luck. I've had this happen too many times. The form/report is toast. I have found no way to recover from this. Good thing you have a back-up. I have a few things I've been working on to avoid this. They aren't anything I'm ready to release yet. Sometimes it's just the subform/subreport though. So try grabbing the backup of those first and see if the main form will open.
Go to the top of the page

Custom Search

RSSSearch   Top   Lo-Fi    19th November 2019 - 11:16 AM