Can't compact -- error 335

B

Bill Brinkworth

I had this compacting routine working for days in my access 2003 program,
then i ran it this morning and got a "you attempted to open a database that
is already opened exclusively by user admin in machine.... (runtime error
3356). I rebooted machine. Nothing else is using it, and as i said it was
running fine in the past. How in the world can i get it to work, i even
added code to close it, buut still...

yes there is a .ldb open on the db..but it worked b4!

here's what i have:
'i just added this..but it doesn't help
Set dbWCData2003 = OpenDatabase("c:\bcs\worldchildren\wcdata2003.mdb")
With dbWCData2003
.Close
End With

'''
DBEngine.CompactDatabase "c:\bcs\worldchildren\wcdata2003.mdb",
"c:\bcs\worldchildren\wcdata2003Compact.mdb"

thank you for your time and help!!!!...in advance....
 
K

Ken Snell [MVP]

If an .ldb file exists for the file before you open it, that file will not
compact when you close it. Delete the .ldb file (assuming that no one else
is working in the database) before you open the file, and then it should
work.
 
B

Bill Brinkworth

It is a linked table. It always has a ldb file. If i go to the table alone,
it compacts, but will not from the front end.
 
K

Ken Snell [MVP]

Not sure what you mean by "from the front end", but if you're thinking that
the backend will compact when you close the front end, the answer is no.

So long as there is a locking file on the database file, you can't compact
it via code (to my knowledge).
 
J

J.C.Rivera

Greetings, Ken...

I'm having this problem, too. Even more, I included a code that checks for
the existance of the .ldb so that it kills it (Kill command). However, I get
an error 70 ("Permission denied") when executes the Kill. Apparently, this
..ldb is being in use by the .mdb itself and doesn't let to be deleted.

Any suggestions?

Thanks.

J.C.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top