Problem running Access Compact & Repair on Vista with UAC enabled

I've got a button on a form that runs the Compact & Repair facility, using code from the EE site:

   Commandbars("menu bar"). _
   Controls("tools"). _
   .
   .
   accDoDefaultAction

and this works fine in Win98, XP etc.   However, in Vista, if the User Account Control is enabled (which it usually is) it throws up an error message saying that the database file can't be deleted because it is read-only (which it isn't), and then creates a db1.mdb file instead.

Any ideas?    I need to keep the action hidden behind a button, and the users do not have a full copy of Access, just the runtime version, so they can't use the normal toolbar way of doing it.    
pauldownhamAsked:
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.

jderaCommented:
Is the user running the compact and repair an administrator?
0
pauldownhamAuthor Commented:
yes
0
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
"Any ideas?  "

Change the UAC settings.  Man, ya gotta love Vista and UAC.  Insane!

M$ motto:  If it works, break it!

mx
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

jderaCommented:
Full permissions to that user in the folder where the database is located?
0

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
pauldownhamAuthor Commented:
I think some users would be uncomfortable with UAC off, because their system would keep recommending them to switch it back on.

Presumably there's no way in VBA to see if UAC is enabled, and if so disable it, do the compact and re-enable?

Paul
0
pauldownhamAuthor Commented:
jdera,

The user has administrator rights, and the folder says these have Full Control.

But out of interest I logged in as the actual administrator and the compact went OK!  So I gave all the Users Full Control, and its also OK.

So that's a bit odd, why it didn't work in the first place?  
0
jderaCommented:
Just the way the compact and repair has to write back to the same database.  Vista just works a bit different.
0
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
Vista has UAC ... and those are the issues.

C&R

1) Compacts into DB1.mdb
2) If successful, tries to delete the original mdb, then rename DB1.mdb to the original.

mx
0
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.