|
-
Jan 6th, 2000, 01:03 AM
#1
Thread Starter
Guru
Possibly on the first line, DB.CLOSE, but that assumes that you have the database open before calling this sub.
Also, if there are multiple users of this database, you cannot get exclusive access to the file and will not be able to compact it unless everyone else who is using the database has also closed their reference to it
-
Jan 6th, 2000, 12:57 PM
#2
New Member
Question. When we use a procedure for compacting a database, is there any untrappable error that could occur during this call:
DBEngine.CompactDatabase sDBName, sBackup
which would then allow
Kill sDBName
to occur thus removing the database from the system?
The entire procedure is below:
Sub CompactDatabase(sDBName As String, sBackup As String)
on error goto errtrap
db.Close
'Check to see if the tempory backup exists
If Len(Dir$(sBackup)) > 0 Then 'Backup exists
Kill sBackup 'Delete it
End If
'Compact the database to the tempory one
DBEngine.CompactDatabase sDBName, sBackup
'Delete the current one
Kill sDBName
'Compact the backup to the actual database
DBEngine.CompactDatabase sBackup, sDBName
'And remove the backup database
Kill sBackup
OpenDB (App.Path & "\demo.mdb")
exit sub
errtrap:
msgbox "there is an error"
End Sub
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
|