PC Review


Reply
Thread Tools Rate Thread

Compact and Repair a database from a macro in a different database

 
 
DDogCap
Guest
Posts: n/a
 
      31st Jul 2008
Can it be done?
Access 2007 - thanks!
 
Reply With Quote
 
 
 
 
Arvin Meyer [MVP]
Guest
Posts: n/a
 
      31st Jul 2008
"DDogCap" <(E-Mail Removed)> wrote in message
news:59D73FDA-F2CD-49A8-A1F7-(E-Mail Removed)...
> Can it be done?
> Access 2007 - thanks!


I don't think that you can do it with a macro, but in VBA code, the syntax
would be similar to:

DBEngine.CompactDatabase "C:\FolderName\DBName.mdb",
"C:\FolderName\DBName.mdb"
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


 
Reply With Quote
 
DDogCap
Guest
Posts: n/a
 
      1st Aug 2008
Hmmm tried that using the RunCode command in a macro but it didn't work.

DBEngine.CompactDatabase "C:\Documents and Settings\Import Parts.mdb",
"C:\Documents and Settings\Import Parts.mdb"

Got an error: can't find the name 'DBEngine'

"Arvin Meyer [MVP]" wrote:

> "DDogCap" <(E-Mail Removed)> wrote in message
> news:59D73FDA-F2CD-49A8-A1F7-(E-Mail Removed)...
> > Can it be done?
> > Access 2007 - thanks!

>
> I don't think that you can do it with a macro, but in VBA code, the syntax
> would be similar to:
>
> DBEngine.CompactDatabase "C:\FolderName\DBName.mdb",
> "C:\FolderName\DBName.mdb"
> --
> Arvin Meyer, MCP, MVP
> http://www.datastrat.com
> http://www.mvps.org/access
> http://www.accessmvp.com
>
>
>

 
Reply With Quote
 
Arvin Meyer [MVP]
Guest
Posts: n/a
 
      3rd Aug 2008
Make sure that you have a reference set to DAO 3.6. From any code window:

Tools >>> References >>> Microsoft DAO3.6 Object Library
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


"DDogCap" <(E-Mail Removed)> wrote in message
news:E6B32C11-0CDD-47BA-A565-(E-Mail Removed)...
> Hmmm tried that using the RunCode command in a macro but it didn't work.
>
> DBEngine.CompactDatabase "C:\Documents and Settings\Import Parts.mdb",
> "C:\Documents and Settings\Import Parts.mdb"
>
> Got an error: can't find the name 'DBEngine'
>
> "Arvin Meyer [MVP]" wrote:
>
>> "DDogCap" <(E-Mail Removed)> wrote in message
>> news:59D73FDA-F2CD-49A8-A1F7-(E-Mail Removed)...
>> > Can it be done?
>> > Access 2007 - thanks!

>>
>> I don't think that you can do it with a macro, but in VBA code, the
>> syntax
>> would be similar to:
>>
>> DBEngine.CompactDatabase "C:\FolderName\DBName.mdb",
>> "C:\FolderName\DBName.mdb"
>> --
>> Arvin Meyer, MCP, MVP
>> http://www.datastrat.com
>> http://www.mvps.org/access
>> http://www.accessmvp.com
>>
>>
>>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Marco - Database Utilties-Compact and Repair Database =?Utf-8?B?RGFubnk=?= Microsoft Access Macros 0 18th Apr 2005 10:15 AM
Database Utility - Compact and Repair Database Mark Microsoft Access VBA Modules 1 8th Jul 2004 07:52 PM
Can I run a macro to Compact and Repair the database. daman Microsoft Access Macros 1 30th Mar 2004 05:31 PM
Compact & Repair of an Access database via a macro m wark Microsoft Access Macros 1 10th Oct 2003 11:19 PM
Compact and Repair Database via Macro Akua Aning Microsoft Access Macros 3 10th Oct 2003 10:22 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:02 AM.