Access 2003 Compact cannot find database

I have a macro that does a RunCommand where Command is CompactDatabase.  I get the error message:

The Microsoft Jet database engine cannot open the file 'C:\Users\Judith\CARE2.8\db1.mdb'.  It is already opened exclusively by another user, or you need permission to view its data.

The file db1.mdb doesn't exist.  The file I'm trying to compact is CareProgram.mdb.  Where is the db1.mdb coming from?

JudithARyanTech SupportAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Kelvin SparksCommented:
The Compact and Repair creates a new db1.mdb with your data compacted, then deletes the original, and then renames db1.mdb as your database. You cannot compact your database while you are in it via a macro or code.

Jeffrey CoachmanMIS LiasonCommented:
You can however do this with an AutoKeys Macro, using Sendkeys
(do a web search of:  Sendkey issues learn about the concerns when using SendKeys)

Something like: %TDC

Not near my Access 2003 box right now, but I am sure another expert can finish this off for you...
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
Have the Permissions on the folder 'C:\Users\Judith\CARE2.8 changed at all recently ??

Are you SURE the db is not open in another instance ?

Do you see an LDB file in that folder ?
Jeffrey CoachmanMIS LiasonCommented:
I think like this:
Create  a macro named "AutoKeys"

Make the Name: ^+C
(This will be the key combination Ctrl+Shift+C)

Then set this as the  Action: SendKeys

Then set this as the argument:  %(TDC)
Or perhaps:  "%(TDC)"

Perhaps not 100% correct syntactically, but that is the general idea

You can see here for more info:

And also see AutoKeys and Sendkeys in the Access help files...


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.