Lost All Forms

J

JamesJ

Has this happened to anyone else?
Designing a form and all of a sudden all form objects are gone in Access
2007.
Access asked to save the design of a form and that was the last I saw
of 10 objects in this db. Showing tables and related views find no more
forms in my
db.

James
 
A

Allen Browne

James, I guess you are trying to find out whether the forms are somewhere
under the surface, even if you can't see them.

Try creating this query:
SELECT MSysObjects.Name
FROM MSysObjects
WHERE MSysObjects.Type = -32768
ORDER BY MSysObjects.Type, MSysObjects.Name;

Alternative approach: open the Immediate Window (Ctrl+G), and enter:
? CurrentProject.AllForms.Count
If there's more than zero, you can try:
? CurrentProject.AllForms(0).Name

Any luck?
 
J

JamesJ

I backed it up a few minutes before. But with ac 2007 I have to
walk on eggshells... corrupted forms and the like. Seems all I need
to do is change the BackColor of a form object and the form becomes
corrupt.

James
 
A

Allen Browne

Excellent. They are still present.

That means they may be marked as hidden objects, or the navigation bar may
be filtered to exclude those objects.

Go to:
Office Button | Access Options | Current Database | Navigation Options.
Under Categories, choose Object Type.
Make sure the Forms box is checked (on the right.)
At the bottom of the dialog, check the boxes for Show Hidden Objects and
Show System Objects.

If you can now see your forms in the Navigation Pane, right-click and choose
View Properties. Make sure the Hidden box is not checked.

Since you can see the names of your forms, you can also try opening one like
this:
1. Press Ctrl+G to open the Immediate window.

2. Enter:
DoCmd.OpenForm "Form1"
substituting your form name for Form1.
If it opens, that may reassure you they are okay.

Let us know how you go.
 
J

JamesJ

No good. Navigation Pane still not showing Forms except for the
one form that I saved the design changes to when this happenned.

James
 
J

JamesJ

No. Putting the DoCmd in the Onclick of a command button
tells me 'Module not Found'. After opening the db I continue
to get error messages of form names being misspelled or don't exist.

James
 
A

Allen Browne

This doesn't sound simple. There could be multiple issues to solve.

Your choices might be to revert to a backup, or get some professional help
to sort it out.
 
J

JamesJ

Allen Browne said:
This doesn't sound simple. There could be multiple issues to solve.

Your choices might be to revert to a backup, or get some professional help
to sort it out.
 
J

JamesJ

Already reverted to my backup. Just trying to figure out
how to avoid this in the future. Scary.
I ran the repair in Access 2007 setup before proceeding to my
backup. Maybe that will make a difference.

Thanks much for your time and effort.
James
 
N

naendaz

James, are you attempting to open a 2003 DB in 2007? If so this might
be your problem. 2007 DBs include new system tables (MSysxxxxxxxx
type table) specific to the Nav Pane. Without valid entries in these
tables, there will be nothing shown on the Navigation Pane.

Because I've only been running 2007 for about 2 hours, I can't help
with a workaround yet! Maybe once my enterprise databases that I work
on get upgraded I'll need to work on that one!

Cheers.
 
M

mista.bert

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!
 
A

Allen Browne

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.
 

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