Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

ADO:  Compact Database?

Posted on 2000-04-26
7
Medium Priority
?
695 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 400 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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
Suggested Courses

704 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