Solved

ADO:  Compact Database?

Posted on 2000-04-26
7
689 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Suggested Courses
Course of the Month5 days, 14 hours left to enroll

626 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