i tried compacting my database using this code i got here :
but it produce the following errorCode:Private Sub cmdRepair_Click() Dim vJet As New JRO.JetEngine Dim vBak As String Dim vBackup As String Dim vSource As String vBak = Left(App.Path & "DB.mdb", InStr(App.Path & "DB.mdb", ".")) & "bak" If CBool(Len(Dir(vBak))) Then Kill vBak vSource = "Data Source=" & App.Path & "\DB.mdb" vBackup = "Data Source=" & App.Path & "\BackUp" vJet.CompactDatabase vSource, vBackup Kill App.Path & "DB.mdb" Name vBak As App.Path & "DB.mdb" MsgBox "Your database was successfully compacted and repaired", vbInformation + vbOKOnly, "SUCCESSFUL" End Sub
Runtime error '2147217911'
the microsoft jet database engine cannot open the file 'E:\AMSystem\bahay\BackUp'.it is already opened exclusivley by another user , or you need permission to view its data..
and it is pointing to this code
vJet.CompactDatabase vSource, vBackup
my system location is at E:\AMSystem\bahay\
can anybody tell me what is wrong?? i already close the database when i runt this code but i still get this error






but willing to dig on facts!
Reply With Quote