VBA Error message

Sgte
2StarLounger
Posts: 164
Joined: 10 Feb 2010, 12:53

VBA Error message

Post by Sgte »

This the latest error message in connection with my forms in an Access 2003 database: "The Visual Basic for Applications in the database is corrupt" I've tried compacting and repairing - but to no avail. Data is backed up. How can I solve this please? Knee jerk reaction is to delete all macros, and formsbut, would this help?

User avatar
HansV
Administrator
Posts: 78237
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: VBA Error message

Post by HansV »

This is a serious problem. It's very unlikely that you'll be able to repair the database itself, but don't despair - you may well be able to recover everything you need.

Is this a split database design, with forms and reports in the frontend and tables in the backend? If so, it's best to go back to a recent non-corrupt copy of the frontend; you won't have to do anything with the backend.

If the database has not been split, try this:
- Retrieve a recent non-corrupt backup copy of the database.
- Delete all tables.
- Import the tables from the corrupt database.
You should now have a working database again, with up-to-date data.
Best wishes,
Hans

Sgte
2StarLounger
Posts: 164
Joined: 10 Feb 2010, 12:53

Re: VBA Error message

Post by Sgte »

Thanks for that Hans,
The database has been split and I have been trying to rebuild the front end forms - then got the above message today. Therefore I suspect that the corruption already existed = Ouch! Therefore no uncorrupted backup.

A basic question, if I may, How do I start a new front end?

User avatar
HansV
Administrator
Posts: 78237
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: VBA Error message

Post by HansV »

If you don't have a non-corrupt backup, you'll have to create the frontend from scratch.
- Create a blank new database.
- Select File | Get External Data | Link Tables...
- Select the backend database.
- Select all tables.
- Select File | Get External Data | Import...
- Select the corrupt frontend.
- Select all queries, and if you have them, all macros.
- You'll have to recreate all forms, reports and modules.
Best wishes,
Hans

Sgte
2StarLounger
Posts: 164
Joined: 10 Feb 2010, 12:53

Re: VBA Error message

Post by Sgte »

Thanks Hans,
It was the table linking I missed. To clarify: am I importing the (possibly) corrupted queries and macros - or is the corruption likely to be associated with forms, reports and modules?

User avatar
HansV
Administrator
Posts: 78237
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: VBA Error message

Post by HansV »

Queries and macros don't have a VBA component, so it's unlikely that they are corrupted.

BTW, if you have forms and reports without a code module (the Has Module property in the Other tab of Properties is set to No), you should be able to import them into your new database too. The corruption occurs in forms and reports that have a module, and in modules in the Modules section of the database window.
Best wishes,
Hans

Sgte
2StarLounger
Posts: 164
Joined: 10 Feb 2010, 12:53

Re: VBA Error message

Post by Sgte »

Many thanks Hans.

Pat
5StarLounger
Posts: 1148
Joined: 08 Feb 2010, 21:27

Re: VBA Error message

Post by Pat »

Maybe a decompile of the FE would help?