Howdy, Stranger!

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

Categories

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

  • jlegjleg Member Posts: 237
    [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


  • Chris BrownChris Brown USAMember Posts: 4,624 ✭✭

    ____ | http://forcoder.org | free ebooks and video tutorials about { PL/SQL Ruby Python Visual Basic .NET C++ R C# C JavaScript Perl Visual Basic Scratch Swift Go Objective-C Delphi Java MATLAB PHP Assembly FoxPro D Julia LabVIEW Transact-SQL Scala Lua Clojure Awk Erlang Kotlin ABAP ML Lisp COBOL F# Prolog Alice Logo Apex Fortran Scheme Rust SAS Ada VBScript Dart Bash Hack Crystal } __________

Sign In or Register to comment.