Solved

ADO:  Compact Database?

Posted on 2000-04-26
7
674 Views
Last Modified: 2013-11-27
ENVIRONMENT:  VB6 SP-3, ADO/ADOX 2.1, Access97 MDBs

How can I programmatically compact a password-protected Access97 database, using straight ADO (no data controls or anything other than straight code)?

I know that I can open this password-protected MDB by using this in the connect string:

   "Jet OLEDB:Database Password=$0mePa$$w0rd;"

but I'd also like to be able to compact it.

Thanks for helpful help.

Breck Ryker
breck_ryker@mpsisys.com

0
Comment
Question by:bryker
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 6

Accepted Solution

by:
Marine earned 100 total points
ID: 2753664
0
 

Expert Comment

by:catdaddy123
ID: 2753691
Information deleted by Community Support
Linda Gardner
Community Support @ Experts Exchange
0
 
LVL 1

Expert Comment

by:Sekans
ID: 2755264
Try this:

Dim sfilename As String, Password As String
Dim OldDBname As String
Dim NewDBname As String
OldDBname = "c:\olddb.mdb"
NewDBname = "c:\NEWdb.mdb"
Password = "PASSWORD" 'must equal password for the database
DBEngine.CompactDatabase OldDBname, NewDBname, dbLangGeneral & ";pwd=" & Password, , ";pwd=" & Password
Kill OldDBname
Name NewDBname As OldDBname

regards,
Sekans
0
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 

Author Comment

by:bryker
ID: 2757191

Are you sure your solution is ADO and not DAO?  Sure looks like DAO.

Anyway, Marine has proposed something that I'm sure will work.  I just had tech difficulties giving him the grade, as the Experts Exchange folks were busy killing catdaddy123's comment.
0
 

Author Comment

by:bryker
ID: 2757221

Haven't tried it yet, but looks like a winner.  It's ADO, it's MS documentation...what's to try?

Thanks a lot.
0
 
LVL 6

Expert Comment

by:Marine
ID: 2757329
Thanks, happy programming :-)
0
 
LVL 1

Expert Comment

by:Sekans
ID: 2758951
bryker,

Sorry, I misunderstood what you were looking for.

regards
sekans
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

896 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now