Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 29th, 2004, 01:03 PM
Authorized User
 
Join Date: Mar 2004
Location: , , USA.
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


Reply With Quote
  #2 (permalink)  
Old March 29th, 2004, 04:49 PM
Authorized User
 
Join Date: Mar 2004
Location: , , .
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.
Reply With Quote
  #3 (permalink)  
Old March 29th, 2004, 06:45 PM
Authorized User
 
Join Date: Mar 2004
Location: , , USA.
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




Reply With Quote
  #4 (permalink)  
Old March 30th, 2004, 06:06 PM
Authorized User
 
Join Date: Mar 2004
Location: , , USA.
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.




Reply With Quote
  #5 (permalink)  
Old March 30th, 2004, 11:11 PM
Authorized User
 
Join Date: Jun 2003
Location: , FL, USA.
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
Reply With Quote
  #6 (permalink)  
Old March 31st, 2004, 06:05 AM
Authorized User
 
Join Date: Mar 2004
Location: , , USA.
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.



Reply With Quote
  #7 (permalink)  
Old March 31st, 2004, 05:33 PM
Authorized User
 
Join Date: Mar 2004
Location: , , USA.
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.


Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 04:08 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.