Question Adding a label box breaks my database

Matt_Lavoie

Registered User.
Local time
Today, 13:44
Joined
Aug 24, 2011
Messages
13
I have an Access 2007 database that works perfectly fine. BUT WAIT!

It has a main form which opens automatically when the database is opened which I wanted to add an ordinary label to. After adding the label (pictured on the bottom of the form in the attached image), if I restart the database it will appear to be fine until I press one of the buttons (which use VBA code). It then gives the shown error and closes.

I've tried compacting/repairing the database before and after the addition and it has not helped. This seems like the dumbest reason for it to fail considering all the other code and things in it. Has anyone seen something like this before?

Thanks in advance!
 

Attachments

  • Error.jpg
    Error.jpg
    87.7 KB · Views: 130
I've tried compacting/repairing the database before and after the addition and it has not helped. This seems like the dumbest reason for it to fail considering all the other code and things in it. Has anyone seen something like this before?

Yes. I've had this happen to me on several occasions over the years. In fact, the majority of the time when I've had a form go corrupt, it was when I was just adding a simple label. There are probably few things in life more frustrating than spending an hour or two designing a form, writing a bunch of code for it, getting it all just right and then have it puke when you go to a simple label. Anytime I am designing, or making major changes to, anything but the simplest of forms, I make a backup about every 5 - 10 minutes.

There's a good chance that it's just your form that's corrupt, not your whole application. You may be able to recover by just deleting the corrupt form and importing another copy of it from a backup file. You do have a backup, right?
 
Ah, glad I'm not the only one! I have working backups and simply deleting the label fixes it, but I wanted to know how to fix it so that I can add the label. Do I have to remake the the form and delete the old one?

Oops, just saw your comment Boblarson - I'm going to try those things too now.
 
That decompile process was very quick and solved it immediately. It actually made the file 100kb larger, but if it prevents errors it's totally worth it. Thanks guys!
 
Last edited:
Wait...
After putting that new version on the server for employees to use, I got a call saying that when they opened it, it told them that it couldn't be opened because it is in a test mode. I tried searching for this and couldn't find anything. I can open it fine.
 
Last edited:
After decompiling:

1. Compact & Repair
2. Compile - i.e. Debug > Compile "Database Name"
3. Compact & Repair again

If that doesn't work, create a new database shell and import all your objects (including custom toolbars/menubars, relationships etc) into the new shell.
 
I followed the decompile steps exactly and had that issue. I ended up importing everything into a new database and the file size was reduced 30% from the already compacted file, and all errors are gone. I guess that was what was necessary. Thanks for the help guys.
 

Users who are viewing this thread

Back
Top Bottom