×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

How to Compact an Encrypted Microsoft Access Database

How to Compact an Encrypted Microsoft Access Database

How to Compact an Encrypted Microsoft Access Database

(OP)
Hey VFP Community!

I wanted to post this since I finally figured it out and it might help someone else. I initially gave up on it but decided to come back to see if I could solve the issue of Compact&Repairing an encrypted Microsoft Access Database through VFP code. Here is my original thread on the topic. thread184-1791777: Help with MS Access Please I would like to thank everyone who helped and lead me on the right path to solving it.

Here is the code.

CODE --> VFP9

lserver=[TestDB.accdb]
lbackdb=[Db_TestDB.accdb]
lcpass=[1234abcd]

oAccess = Createobject([Access.Application])
*!* oAccess.Visible=.T.
oAccess.Application.DBEngine.CompactDatabase(lserver, lbackdb, .F., .F., ";pwd="+lcpass)
oAccess.Quit()

Erase &lserver
Rename &lbackdb To &lserver 

The missing part I found was I had to tell the DBEngine that the last part was the password with the ";pwd=1234abcd" in order for it to correctly open it.
My Microsoft database sits on a network drive so my code has the full path added to the server names which I removed from the code snippet above. If anyone does this just make sure there are no quotes in the lserver variable or else it will fail on you.

I hope this helps someone else out! :)

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close