|
-
May 28th, 2002, 04:04 PM
#1
Thread Starter
Fanatic Member
Compact and Reapair Access db from Access?
I have the following code that compacts and repairs an access table from vb.
Public Sub MaintainDataFile(MDBfilename)
'init
Dim vJet As New JRO.JetEngine
Dim vBak As String
Dim vBackup As String
Dim vSource As String
'if bak exists, kill it
vBak = Left(MDBfilename, InStr(MDBfilename, ".")) & "bak"
If CBool(Len(Dir(vBak))) Then Kill vBak
'compact/repair & backup
vSource = "Data Source=" & MDBfilename
vBackup = "Data Source=" & vBak
vJet.CompactDatabase vSource, vBackup
Kill MDBfilename
Name vBak As MDBfilename
End Sub
When I try this code from within the Access program, I get the error message that says the database has been placed in a state by user 'Admin' that prevents it from being opened or locked.
Is there a way to use code to compact and repair an access database from within that Access program?
Thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|