Repairing a Corrupted Access file Using VB 6.0

Does someone know the VB code to Open an access database, exclusively, to compact and repair it?

Opening it has been easy and compacting hasn't been tough but I can't get it repair a damaged database with using Access or microsofts jetcomp program.


Help....

Comments

  • [b][red]This message was edited by jleg at 2002-10-23 14:51:11[/red][/b][hr]
    : Does someone know the VB code to Open an access database, exclusively, to compact and repair it?
    :
    : Opening it has been easy and compacting hasn't been tough but I can't get it repair a damaged database with using Access or microsofts jetcomp program.
    :
    :
    : Help....
    :
    You can use CompactDatabase and RepairDatabase methods of the DBEngine object.

    eg:

    DBEngine.CompactDatabase strInput strOutput

    This compacts the database. strInput is the database file to be actioned on and strOutput is the resultant compacted database file name.

    DBEngine.RepairDatabase strInput

    This repairs a database. A trapable error 3049 can be checked for. This error indicates the database is possibly corrupt and therefore RepairDatabase method can be implemented.

    To open a database exclusively:

    Set db = dbEngine.Workspaces(0).OpenDatabase (strDBase,True)

    Hope this helps.

    John


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion