Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CompactDatabase error 3356

Status
Not open for further replies.

easycode

Programmer
Jan 28, 2005
195
US
I need to compact a database and i am getting this error message, and i am the only one working on it.
Run-time error '3356': You attempted to open a database that is already opened exclusively by user Admin on machine FL111 try again when the database is available

Here is the code:

strBackupName = "testdatabase.mdb"

'-- Does today's backup exist?
If Dir(strBackupName) = "" Then
strDatabaseName = "c:\mydatabase.mdb"
DBEngine.CompactDatabase strDatabaseName, strBackupName
MsgBox "Database has been backed up to " & vbCrLf _
& "strBackupName"
Endif



Any help is appreciated
thanks
 
A shot in the dark: check to see if there is an .ldb file present when the mdb is closed - if so, delete it.....

I have great faith in fools; self-confidence my friends call it.
-Poe
 
Thanks for replying,
yes there is an .lbd file but this file is alwasys there when you open the database, how can you delete the file
 
When i try to delete the file, got an error message that says "Sharing violation" The source or destination file may be in use
 
Look in the directory when the mdb is closed. If it is still there, highlight & delete....

I have great faith in fools; self-confidence my friends call it.
-Poe
 
When the mdb file is closed the .ldb file is deleted by itself
 
And therein lies the rub. It can persist if the database is corrupted or errors at closing.

I have great faith in fools; self-confidence my friends call it.
-Poe
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top