Solved

ADO:  Compact Database?

Posted on 2000-04-26
7
672 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
Comment Utility
0
 

Expert Comment

by:catdaddy123
Comment Utility
Information deleted by Community Support
Linda Gardner
Community Support @ Experts Exchange
0
 
LVL 1

Expert Comment

by:Sekans
Comment Utility
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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 

Author Comment

by:bryker
Comment Utility

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
Comment Utility

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
Comment Utility
Thanks, happy programming :-)
0
 
LVL 1

Expert Comment

by:Sekans
Comment Utility
bryker,

Sorry, I misunderstood what you were looking for.

regards
sekans
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

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…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
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…

762 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

7 Experts available now in Live!

Get 1:1 Help Now