Telephone:
01273 552955

More contact details

 

Knowledgebase Categories:

Database Development

PC General

Programming

Servers and Networks

Web Development

Web Hosting

Knowledgebase

Repairing a Microsoft Access Database (06 Jun 2006)

Access databases are prone to get corrupted occasionally. It's important to backup your database regularly. If you don't have a backup then the first thing to try in order to recover a corrupted database is the Compact and Repair Database function, found in Tools -> Database Utilities. If this doesn't solve the problem then the next option is to create a new blank database and to import the components using File -> Get External Data -> Import.

In one case which we looked at recently there was a bit more to do. The database was mostly still working, but use of certain functions was causing error messages to be thrown up. The compact function would cause Access to crash. Using the import method mentioned above worked for all but two of the tables. One of these failed with an "Invalid Argument" message, the other caused an Access crash.

For these two tables I took the following approach. I exported just the data definition of the table from the corrupted database into the new one. I set up the two empty tables in the new database as linked tables in the corrupted database. Then I wrote VBA code to read the corrupted tables record-by-record and write them to the new table. For one table this worked first time. For the other table there were two records for which a Memo field had to be excluded from the copy. Then it was simply a case of renaming the databases and all was well again.

Post a comment

Name:

Comments: (you may use HTML tags for style)

The information is provided 'as is'. It has worked for us, but it may not work for you, so you use it at your own risk. We can't enter into any correspondance about anything recorded here but please feel free to leave a comment.

Geographical coverage: AlphaOne Computing Services provides a range of small business computer support and I.T. services throughout Sussex, including Brighton, Hove, Shoreham, Worthing, Steyning, Burgess Hill, Haywards Heath, Crawley, Lewes, Newhaven, Seaford, Uckfield and Eastbourne.