PC Review


Reply
Thread Tools Rate Thread

compact Access DB from Excel

 
 
=?Utf-8?B?SlQ=?=
Guest
Posts: n/a
 
      3rd May 2007
I'm using the following code in Excel to allow users to compact their Access
database.

vDB = ActiveWorkbook.Sheets("Info").Range("C5")

Set AppAcc = New Access.Application
AppAcc.Visible = False
AppAcc.OpenCurrentDatabase vDB

DoCmd.SetWarnings False

AppAcc.CommandBars("Menu Bar").Controls("Tools").Controls("Database
utilities"). _Controls("Compact and repair database...").accDoDefaultAction

DoCmd.SetWarnings True
AppAcc.Visible = True
AppAcc.Quit acQuitSaveNone

Set AppAcc = Nothing

I would like to do a couple of things differently:

(1) I would like to change the directory the users will see on the dialog
box instead of the path and directory where the macro resides.

(2) I would like to display a message if the users selects the "cancel"
option instead of saving the database.

Is it possible to do make either one of these changes? Any help getting
started would be appreciated. Thanks for the help...
--
JT
 
Reply With Quote
 
 
 
 
=?Utf-8?B?SGF0ZXNJVA==?=
Guest
Posts: n/a
 
      3rd May 2007
one solution?, command line approach

CreateObject("WScript.Shell").Run "MSAccess " & _
Chr(34) & ActiveWorkbook.Sheets("Info").Range("C5") & _
Chr(34) & "/runtime /compact", 0, True

HTH

"JT" wrote:

> I'm using the following code in Excel to allow users to compact their Access
> database.
>
> vDB = ActiveWorkbook.Sheets("Info").Range("C5")
>
> Set AppAcc = New Access.Application
> AppAcc.Visible = False
> AppAcc.OpenCurrentDatabase vDB
>
> DoCmd.SetWarnings False
>
> AppAcc.CommandBars("Menu Bar").Controls("Tools").Controls("Database
> utilities"). _Controls("Compact and repair database...").accDoDefaultAction
>
> DoCmd.SetWarnings True
> AppAcc.Visible = True
> AppAcc.Quit acQuitSaveNone
>
> Set AppAcc = Nothing
>
> I would like to do a couple of things differently:
>
> (1) I would like to change the directory the users will see on the dialog
> box instead of the path and directory where the macro resides.
>
> (2) I would like to display a message if the users selects the "cancel"
> option instead of saving the database.
>
> Is it possible to do make either one of these changes? Any help getting
> started would be appreciated. Thanks for the help...
> --
> JT

 
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
Re: Compact and Repair Access 2000 DB from Access 2007 Jeff Boyce Microsoft Access 0 25th Sep 2009 01:57 PM
Re: Compact and Repair Access 2000 DB from Access 2007 Jeff Boyce Microsoft Access 1 24th Sep 2009 05:08 PM
Compact Access Database from Excel via VBA SSweez@gmail.com Microsoft Access 1 6th Jul 2007 07:52 PM
Compact an Access Applicaton by checking Compact on Close tomlebold@msn.com Microsoft Access 2 15th Jan 2007 07:00 PM
Compact the access-DB Eitan M Microsoft Access 4 31st May 2006 11:25 AM


Features
 

Advertising
 

Newsgroups
 


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