Solved

ADO:  Compact Database?

Posted on 2000-04-26
7
679 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
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 

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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

808 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