Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 29th, 2004, 01:03 PM
Authorized User
 
Join Date: Mar 2004
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default Compacting Access Database from code

Hi :

is it possible to compact a password protected Access 2000 database from code? I tied this:

DBEngine.CompactDatabase "c:\backend.mdb", "c:\backend1.mdb", ";pwd=password"

but I get an "Invalid password" error. Yet the password correctly open backend.mdb without a fuss in normal circumstances.

Any help would be greatly appreciated.

Thanks,

Ian


 
Old March 29th, 2004, 04:49 PM
Authorized User
 
Join Date: Mar 2004
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

DBEngine.CompactDatabase "c:\backend.mdb", "c:\backend1.mdb", dbLangGeneral & ";pwd=password"

I’ve never tried to compact a password protected database, but from the information within the Access help file I believe that you only need to specify the password “;pwd=” option if you intend to specify a new password in the newdb.

This should work

DBEngine.CompactDatabase "c:\backend.mdb", "c:\backend1.mdb"

regardless of the database being password protected as the "c:\backend1.mdb" should inherit the original password protection.
 
Old March 29th, 2004, 06:45 PM
Authorized User
 
Join Date: Mar 2004
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi:

thanks a lot for replying - I checked out your suggestions - but no joy I'm afraid. I'm coming to the conclusion that maybe it can't be done.

Ian




 
Old March 30th, 2004, 06:06 PM
Authorized User
 
Join Date: Mar 2004
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I wonder if someone could try this and let me know if it is in fact possible or not - I can't find any documentation on it - at least nothing that specifically refers to compacting a secured database from code... nothing that I can make work.

Thanks.




 
Old March 30th, 2004, 11:11 PM
Authorized User
 
Join Date: Jun 2003
Posts: 91
Thanks: 0
Thanked 0 Times in 0 Posts
Default

See if this will answer your question....

http://www.mvps.org/access/general/gen0041.htm

Kenny Alligood
 
Old March 31st, 2004, 06:05 AM
Authorized User
 
Join Date: Mar 2004
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks, but it's not the current database I want to compact. I have a separate Access front end and back end - the back end has no code - just data - and it's pwd secured.

I want to compact the back end from the front end - works fine if the back end isn't pwd protected - but I can't get it to work when the pwd is on.

My research suggests it should work - but I haven't had much luck.



 
Old March 31st, 2004, 05:33 PM
Authorized User
 
Join Date: Mar 2004
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I found the answer elsewhere - for anyone who may be interested, the syntax is:

DBEngine.CompactDatabase "c:\backend.mdb", "c:\backend1.mdb", ";pwd=password", , ";pwd=password

To those who replied - thank you for your help.







Similar Threads
Thread Thread Starter Forum Replies Last Post
compacting database pblm MathLearner VB Databases Basics 8 September 27th, 2007 07:34 AM
Compacting database Scootterp Access VBA 5 August 9th, 2006 09:33 AM
compacting access Tasha Access VBA 3 August 9th, 2004 07:46 PM
Compacting Access Database problem imaley SQL Language 1 April 23rd, 2004 11:28 AM
Compacting a large database takabyte Classic ASP Databases 1 February 5th, 2004 12:58 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.