The same thing just happened to me. I was in the middle of designing
a form and module. It asked me to save...I did...went back the the
forms selector, and poof. Went over to Modules, and poof.
I just lost about 8 hours of work. I'm thoroughly disgusted. I've
never seen anything this drastic and unrecoverable happen in any
program. I tried closing and reopening...tried exiting Access and
reopening...tried compact and repair...tried the query you mentioned,
which did list the missing forms...but I can't gain access to them or
to my modules.
This is dismal.
The only thing I can think of is that I had programatically initiated
a NewForm command, which was still sitting open. I didn't know how it
worked; rather than creating the form behind the scenes, it had
actually displayed an empty for in design mode, and then stopped.
That's the form I was closing and about to discard, when everything
just...disappeared.
Unbelievable. And I'm supposed to deliver an application using this
tool...? I couldn't even trust this for tracking my CD collection!
We can identify with the frustration at losing your work, but perhaps your
question goes beyond the immediate frustration to the longer term. Here's a
suggestion if you are genuinely asking, "How can I avoid this from happening
again?"
Firstly, there's just a slight chance that you may be able to find the
missing module by locating an odd name in this query:
SELECT MSysObjects.Name
FROM MSysObjects
WHERE MSysObjects.Type = -32761
ORDER BY MSysObjects.Name;
Sometimes you can identify a temp module there, and find your code again.
Probably not if you already compacted.
Anyway, suggestions on how you can use Access reliably.
Make sure Name AutoCorrect is off.
From main Access window:
Tools | Options | General
Make sure Compile on Demand is off.
From VBA window:
Tools | Options
Don't edit code in break mode. Just as you cannot go plugging more RAM chips
into your computer while it is running, you cannot go stuffing more code
into your module while the code is running.
I wasn't clear from your post whether you created a new form, or a new
instance of a form with the New keyword. Editing while an instance is open
would be inviting disaster.
Backup every few hours - typically 3 times a day (when you stop for lunch,
dinner, and sleep), without overwriting previous backups.
Compact *after* each backup. This leaves you the uncompacted backup in case
something goes wrong. (Doubly important in A2007.)
Decompile periodically - typically after the final compact at the end of
each day's heavy development, but sooner if there is any indication that
something is not right. Then compact again.
At the end of each day's development, copy the backup file to another
location (different computer, USB memory stick, ...), again without
overwriting previous backups.
Before any major change, copy the code out to Notepad, and you can easily go
back if it doesn't work out.
If something does go wrong, make a copy of the file before trying to fix it.
That way, you get multiple goes at solving the problem.
Maybe that all sounds rather basic, but it's just the voice of experience.
I've lost stuff in the past, but it's been years now since I've lost more
than a couple of hours worth of work.
Hope you're feeling less frustrated by the time you read this, and that it
doesn't come across as merely closing the gate after the horse escaped. It's
intended as the voice of experience, addressing your question of how you can
use Access as a reliable development tool.

Signature
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
> The same thing just happened to me. I was in the middle of designing
> a form and module. It asked me to save...I did...went back the the
[quoted text clipped - 18 lines]
> Unbelievable. And I'm supposed to deliver an application using this
> tool...? I couldn't even trust this for tracking my CD collection!