M
Marc T
Hi All,
I have a split database which has the following VBA macro to compact/repair
the back end database:
Private Sub Form_Unload(Cancel As Integer)
Dim strBackupBackend As String
Dim strCurrBackend As String
Dim strCurrLockFile As String
strCurrBackend = "H:\Data\Doc Tracker Master 00000_be.mdb"
strCurrLockFile = "H:\Data\Doc Tracker Master 00000_be.ldb"
strBackupBackend = "H:\Data\Doc Tracker Master 00000_be.bak"
If Len(Dir(strCurrLockFile)) > 0 Then
MsgBox strCurrBackend & " is still in use. " & _
"It cannot be compacted."
Else
If Len(Dir(strBackupBackend)) > 0 Then
Kill strBackupBackend
End If
Name strCurrBackend As strBackupBackend
DBEngine.CompactDatabase strBackupBackend, strCurrBackend
End If
End Sub
This works a treat, but as there are numerous copies of the database, I was
wondering if there was a way to set strCurrBackEnd, strCurrLockFile &
strBackupBackend dynamically to save time?
To make things easier, each database follows the following naming convention
(with the 01234 part changing):
Frontend - "Doc Tracker Master 01234.mdb"
Backend - "Data\Doc Tracker Master 01234_be.mdb"
Lock File - "Data\Doc Tracker Master 01234_be.ldb"
Any help would be much appreciated as ever!
Marc
I have a split database which has the following VBA macro to compact/repair
the back end database:
Private Sub Form_Unload(Cancel As Integer)
Dim strBackupBackend As String
Dim strCurrBackend As String
Dim strCurrLockFile As String
strCurrBackend = "H:\Data\Doc Tracker Master 00000_be.mdb"
strCurrLockFile = "H:\Data\Doc Tracker Master 00000_be.ldb"
strBackupBackend = "H:\Data\Doc Tracker Master 00000_be.bak"
If Len(Dir(strCurrLockFile)) > 0 Then
MsgBox strCurrBackend & " is still in use. " & _
"It cannot be compacted."
Else
If Len(Dir(strBackupBackend)) > 0 Then
Kill strBackupBackend
End If
Name strCurrBackend As strBackupBackend
DBEngine.CompactDatabase strBackupBackend, strCurrBackend
End If
End Sub
This works a treat, but as there are numerous copies of the database, I was
wondering if there was a way to set strCurrBackEnd, strCurrLockFile &
strBackupBackend dynamically to save time?
To make things easier, each database follows the following naming convention
(with the 01234 part changing):
Frontend - "Doc Tracker Master 01234.mdb"
Backend - "Data\Doc Tracker Master 01234_be.mdb"
Lock File - "Data\Doc Tracker Master 01234_be.ldb"
Any help would be much appreciated as ever!
Marc