PC Review


Reply
Thread Tools Rate Thread

CompactOnClose Property

 
 
Anthony
Guest
Posts: n/a
 
      20th Dec 2006
Is there a way to use VBA to programatically enable/disable the
"CompactOnClose" property of an external database?




 
Reply With Quote
 
 
 
 
Douglas J. Steele
Guest
Posts: n/a
 
      20th Dec 2006
CompactOnClose is an application property, not a database property. You'd
set it using

Application.SetOption "Auto Compact", -1

Note, though, that it doesn't do anything with external databases: it only
applies to the database you've currently got open.


--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"Anthony" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> Is there a way to use VBA to programatically enable/disable the
> "CompactOnClose" property of an external database?
>
>
>
>



 
Reply With Quote
 
Douglas J. Steele
Guest
Posts: n/a
 
      20th Dec 2006
Interesting. I know that it's an Application property, which you can set
through Application.SetOptions("Auto Compact"): I didn't realize it was also
a database property.


--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"Daniel" <(E-Mail Removed)> wrote in message
news:28020E1F-4595-4C98-BEB5-(E-Mail Removed)...
> Anthony
>
> Public Sub SetAutoCompact(fAutoCompact As Boolean)
> Dim Dbs As DAO.Database
> Dim Prp As DAO.Property
> Const conPropNotFoundError = 3270
> Set Dbs = CurrentDb
> On Error Resume Next
> Dbs.Properties("Auto compact") = fAutoCompact
> If Err.Number = conPropNotFoundError Then
> Set Prp = Dbs.CreateProperty("Auto compact", _
> dbBoolean, fAutoCompact)
> Dbs.Properties.Append Prp
> End If
> End Sub
>
> Daniel
>
>
>
>
> "Anthony" wrote:
>
>> Is there a way to use VBA to programatically enable/disable the
>> "CompactOnClose" property of an external database?
>>
>>
>>
>>
>>



 
Reply With Quote
 
Anthony
Guest
Posts: n/a
 
      20th Dec 2006
Okay, thank you!

Now how do I programmatically cause that database to bypass startup
(AutoExec Macro and Startup object)?


"Douglas J. Steele" <NOSPAM_djsteele@NOSPAM_canada.com> wrote in message
news:(E-Mail Removed)...
> CompactOnClose is an application property, not a database property. You'd
> set it using
>
> Application.SetOption "Auto Compact", -1
>
> Note, though, that it doesn't do anything with external databases: it only
> applies to the database you've currently got open.
>
>
> --
> Doug Steele, Microsoft Access MVP
> http://I.Am/DougSteele
> (no private e-mails, please)
>
>
> "Anthony" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
>> Is there a way to use VBA to programatically enable/disable the
>> "CompactOnClose" property of an external database?
>>
>>
>>
>>

>
>



 
Reply With Quote
 
Douglas J. Steele
Guest
Posts: n/a
 
      20th Dec 2006
How are you trying to open the database?

If you're trying to use Automation, take a look at the kludge approach
outlined in section "Bypassing Startup Settings When Opening a Database" in
http://support.microsoft.com/kb/147816/ (Don't worry that it says Access 97:
it applies to all versions). The reason I call it a kludge is that it uses
SendKeys, which is seldom recommended in product grade applications.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"Anthony" <(E-Mail Removed)> wrote in message
news:OYXyH$(E-Mail Removed)...
> Okay, thank you!
>
> Now how do I programmatically cause that database to bypass startup
> (AutoExec Macro and Startup object)?
>
>
> "Douglas J. Steele" <NOSPAM_djsteele@NOSPAM_canada.com> wrote in message
> news:(E-Mail Removed)...
>> CompactOnClose is an application property, not a database property. You'd
>> set it using
>>
>> Application.SetOption "Auto Compact", -1
>>
>> Note, though, that it doesn't do anything with external databases: it
>> only applies to the database you've currently got open.
>>
>>
>> --
>> Doug Steele, Microsoft Access MVP
>> http://I.Am/DougSteele
>> (no private e-mails, please)
>>
>>
>> "Anthony" <(E-Mail Removed)> wrote in message
>> news:%(E-Mail Removed)...
>>> Is there a way to use VBA to programatically enable/disable the
>>> "CompactOnClose" property of an external database?
>>>
>>>
>>>
>>>

>>
>>

>
>



 
Reply With Quote
 
Anthony
Guest
Posts: n/a
 
      20th Dec 2006
thank you -- I will try it

"Douglas J. Steele" <NOSPAM_djsteele@NOSPAM_canada.com> wrote in message
news:%(E-Mail Removed)...
> How are you trying to open the database?
>
> If you're trying to use Automation, take a look at the kludge approach
> outlined in section "Bypassing Startup Settings When Opening a Database"
> in http://support.microsoft.com/kb/147816/ (Don't worry that it says
> Access 97: it applies to all versions). The reason I call it a kludge is
> that it uses SendKeys, which is seldom recommended in product grade
> applications.
>
> --
> Doug Steele, Microsoft Access MVP
> http://I.Am/DougSteele
> (no private e-mails, please)
>
>
> "Anthony" <(E-Mail Removed)> wrote in message
> news:OYXyH$(E-Mail Removed)...
>> Okay, thank you!
>>
>> Now how do I programmatically cause that database to bypass startup
>> (AutoExec Macro and Startup object)?
>>
>>
>> "Douglas J. Steele" <NOSPAM_djsteele@NOSPAM_canada.com> wrote in message
>> news:(E-Mail Removed)...
>>> CompactOnClose is an application property, not a database property.
>>> You'd set it using
>>>
>>> Application.SetOption "Auto Compact", -1
>>>
>>> Note, though, that it doesn't do anything with external databases: it
>>> only applies to the database you've currently got open.
>>>
>>>
>>> --
>>> Doug Steele, Microsoft Access MVP
>>> http://I.Am/DougSteele
>>> (no private e-mails, please)
>>>
>>>
>>> "Anthony" <(E-Mail Removed)> wrote in message
>>> news:%(E-Mail Removed)...
>>>> Is there a way to use VBA to programatically enable/disable the
>>>> "CompactOnClose" property of an external database?
>>>>
>>>>
>>>>
>>>>
>>>
>>>

>>
>>

>
>



 
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
CompactOnClose Ron Hinds Microsoft Access 1 26th Jul 2007 01:08 AM
CompactOnClose Property Anthony Microsoft Access VBA Modules 5 20th Dec 2006 10:50 PM
when i set the BackgroundImage property in the designer the image still doesnt show in the background of the textbox any other property must be set? Daniel Microsoft Dot NET 0 2nd Nov 2004 02:03 AM
The controls on this property sheet are disabled because one or more other Network property sheets are already open. To use these controls, close all these property sheets and then reopen this one. =?Utf-8?B?Um9iZXJ0?= Microsoft Windows 2000 Networking 1 11th Apr 2004 12:22 AM
Setting CompactOnClose from VBA Adam Microsoft Access 0 17th Mar 2004 08:41 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:52 AM.