HELP!! - All my code disappeared!!!

A

Andrew

Hi all

I am REALLY hoping someone will be able to help me with this.

I have a database on which I have been working for a while. It's
stored as an mdb file in Access 2003 format.

There are around 40 forms, each with associated modules, plus about 6
standard modules.

I have a form (called frmFrame) which simply contains a navigation
system based on option buttons in a frame, to allow the users to
navigate to various subforms which then fill the childform control
('ChildForm') which takes up most of frmFrame. The code behind the
frame basically says "me.childform.sourceobject=..." Some of the
subforms themselves have subforms, and employ a similar navigational
technique.

All has been fine until about 20 mins ago. I clicked on a navigation
button in frmFrame, and instead of the subform showing with its data,
it simply showed as an empty child fom object. Clicking on a different
navigation button resulted in "You have referred to an object which is
closed or doesn't exist." This was displayed in a message box, as I
had implemented error handling, which trapped the error. I order to
find out where this error occurred, I went to the VBA window and
turned on "Break on all errors". Then I tried the same thing again,
and was pointed to a line which contained a reference to frmFrame. I
hit the Break button - and it did just that!! Broke everything!

By force of habbit, before looking at the error, I hit the save
button, to be told "The database is not in a format recognised by MS
Access" - or words to that effect - and that therefore frmFrame cannot
be saved.

Being very suspicious by this point, I firstly tried to compile the
DB, which worked apparently successfully, then to Compact and Repair.
Once again, I got the message about the file not being in a
recognisable format. On being asked "Do you want access to attempt to
repair the file?" I made the mistake (it seems) of saying yes. The
file compacted, repaired, and reopened. But now none of the buttons
work. And going to the VBA editor, I find that none of my code exists
any more! Not a line! No class modules, form modules or standard
modules. Closing and re-opening the db (kind of like pinching myself
after a bad dream) did not help......

Can anyone help me? Tell me that it hasn't all been wiped out....
There's no sign of any temp files or anything else that I can try to
get into - at least not in the same folder as the mdb file.

Thankfully, I do have various backups, the last of which would mean
that I've lost all the work done today - I tend to make backups at the
end of each day - so it's not a case that everything's gone, but I
would really like to know what's happened to try to prevent it from
happening again.

I compile the code about every 5 mins max, or whenever I write a new
procedure
I save every time I make any change to code or design.
I eat my greens every day.

Help!

Thank you.
Andrew
 
G

Guest

Have you tried looking at one of your backup copies. If you do not have I
got this from previous posts

http://members.iinet.net.au/~allenbrowne/ser-47.html

Try Tony Toews' article:

http://www.granite.ab.ca/access/corruptmdbs.htm

and Microsoft Knowledge Base article:

http://support.microsoft.com/?id=209137

or

It can possibly be saved. First, always work on a copy of the database.
Working on the original may make it impossible for a repair service to fix
it.

Download a copy of JetComp.exe:

http://support.microsoft.com/default.aspx?scid=kb;EN-US;273956

Also have a look at the Microsoft KB article:

http://support.microsoft.com/default.aspx?scid=kb;EN-US;209137

Then have a look at Tony Toews' Access Corruption FAQ at:

http://www.granite.ab.ca/access/corruptmdbs.htm

for some suggestions. Unfortunately, some corruption cannot be fixed - you
may need to create a new database, import what can be salvaged, and recreate
the rest.

Although it's a paid service, Peter Miller does an outstanding job of saving
corrupt databases. Try this URL:

http://www.pksolutions.com
 
6

'69 Camaro

Hi, Andrew.
By force of habbit, before looking at the error, I hit the save
button, to be told "The database is not in a format recognised by MS
Access" - or words to that effect

It sounds as if the file has been corrupted.
Being very suspicious by this point, I firstly tried to compile the
DB, which worked apparently successfully, then to Compact and Repair.

If this ever happens in the future, make a copy of the database and work
with the copy. If the copy gets trashed, your original database file still
exists, and a repair service may be able to salvage data from it. After
compacting and repairing a corrupted database, data and objects may be lost,
or one may not even be able to open the file ever again.
Once again, I got the message about the file not being in a
recognisable format. On being asked "Do you want access to attempt to
repair the file?" I made the mistake (it seems) of saying yes.

Always press the "No" button, unless you've copied the database file just
before Access choked.
The
file compacted, repaired, and reopened. But now none of the buttons
work. And going to the VBA editor, I find that none of my code exists
any more! Not a line! No class modules, form modules or standard
modules. Closing and re-opening the db (kind of like pinching myself
after a bad dream) did not help......

Sometimes repairs get rid of lost pointers instead of fixing them, so
whatever was being pointed to is now inaccessible or else gone from the
newly compacted database file.
Can anyone help me? Tell me that it hasn't all been wiped out....

I don't want to lie to you. It's probably gone.
Thankfully, I do have various backups, the last of which would mean
that I've lost all the work done today

Good job on doing regular backups in case something goes wrong. (You'd be
surprised how often the latest backup was months ago when Access developers
or user lose their Access database.) It would probably be cheaper to create
a new database file and import the data from the existing, corrupt database
file into it, confirm the data is "good," then import the objects from the
backup file into it, than it would be to hire a recovery service to
_possibly_ recover the modules from the existing corrupt database file.

When I'm developing, I usually back up the files every four hours or so and
again just before major changes. That way, the most I lose is half a day's
work.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
Blogs: www.DataDevilDog.BlogSpot.com, www.DatabaseTips.BlogSpot.com
http://www.Access.QBuilt.com/html/expert_contributors2.html for contact
info.
 
A

Andrew

If this ever happens in the future, make a copy of the database and work
with the copy. If the copy gets trashed, your original database file still
exists, and a repair service may be able to salvage data from it. After
compacting and repairing a corrupted database, data and objects may be lost,
or one may not even be able to open the file ever again.

Hmmm.. Well, there's no risk to data, as I am working on a development
copy so as not to risk the data...
Always press the "No" button, unless you've copied the database file just
before Access choked.

Yes. Thanks. So where were you when the dialogue box popped up, with
your good advice???!!!! :)
No, seriously, thanks. I do appreciate the advice, and it's not a
mistake I'll make a second time. I think I just made the mistake of
thinking "nothing major can have happened - I've been working fine all
day!" which is, of course, just when bad things tend to happen.... I
suppose also thought that it was less likely to be a serious error
because of working on a local drive, where there was no risk of
uncommitted writes or incomplete saves because of network issues etc.
Just goes to show....

I don't want to lie to you. It's probably gone.

That's not what I asked you to tell me! But I think you're probably
right. Back to the backup copy it is then...
Good job on doing regular backups in case something goes wrong. (You'd be
surprised how often the latest backup was months ago when Access developers
or user lose their Access database.) It would probably be cheaper to create
a new database file and import the data from the existing, corrupt database
file into it, confirm the data is "good," then import the objects from the
backup file into it, than it would be to hire a recovery service to
_possibly_ recover the modules from the existing corrupt database file.

When I'm developing, I usually back up the files every four hours or so and
again just before major changes. That way, the most I lose is half a day's
work.

Hmmm... Thinking about it, quite a lot of the work I've done today has
been "pondering" - trying to find solutions to problems and test the
solutions once discovered, rather than writing acres of code, so I
guess I'm lucky in that sense. Now all that remains is to re-think of
those solutions!

Thanks again for your thoughts.

Regards
Andrew
 
6

'69 Camaro

Hi, Andrew.
Yes. Thanks. So where were you when the dialogue box popped up, with
your good advice???!!!! :)

Like most consultants, I was just an E-mail or phone call away. :)
Hmmm... Thinking about it, quite a lot of the work I've done today has
been "pondering" - trying to find solutions to problems and test the
solutions once discovered, rather than writing acres of code, so I
guess I'm lucky in that sense. Now all that remains is to re-think of
those solutions!

If it's any consolation, the second time is faster, because you'll remember
which things didn't work as you readdress each one again.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
Blogs: www.DataDevilDog.BlogSpot.com, www.DatabaseTips.BlogSpot.com
http://www.Access.QBuilt.com/html/expert_contributors2.html for contact
info.
 

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