Attempts to repair a corrupted Microsoft Access database.
RepairDatabase ( dbname )
The RepairDatabase statement has this part:
dbname A string expression that is the path and file name for an existing Microsoft Access database file. If you omit the path, only the current directory is searched. You can also specify a fully qualified network path, such as \\MYSERVER\MYSHARE\MYDIR\MYDB. If dbname refers to a database that has already been opened by another user, or if dbname doesn't exist, an error occurs.
This statement repairs a Microsoft Access database that was left invalid by an incomplete write operation. This can occur if Visual Basic or your application quits unexpectedly because of a power outage or computer hardware problems. The database will not be left invalid if you use the Close method or if Visual Basic and your program exit normally.
RepairDatabase also attempts to validate all system tables and all indexes. Any data that cannot be salvaged is discarded.
When you attempt to open or compact a corrupted database, a trappable error occurs. In some situations, a corrupted database may not be detected and no error occurs. It's a good idea to provide your users with a way to execute the RepairDatabase statement in your application if their database behaves unpredictably.
It's also a good idea after repairing a database to compact it with CompactDatabase.