473,569 Members | 2,536 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Compact on Close Code

In my startup routine, I have the following code:

s = CLng(FileLen(fi lespec) / 1000000)

If s > 5 Then

'FIRST, BACKUP THE FRONT END
If BackupFrontEnd = False Then
Exit Function
End If

'Now set the autocompact at close
Application.Set Option ("Auto Compact"), 1 'compact app
Else
Application.Set Option ("Auto Compact"), 0 'no don't compact app
End If

s is the size of the front end in MB. BackupFrontEnd is a function that
first backups the front end. It is working fine.

The idea is if the front end gets beyond a certain size (set to 5 MB here
for testing), the compact on close option is to be set so that when the
user closes the front end it will compact. I don't want to compact after
every close.

Here's the problem. It works fine if a user is an administrator. I can
verify that compacting occurs upon closing the front end by looking at the
status bar. If the user is part of the Users group, however, then
compacting does not occur. I have stepped through the code when logged on
as a regular user. The code definately sets the Auto Compact Option to 1. I
then double checked by typing in the Immediate Pane:

?Application.Ge tOption ("Auto Compact")

-1 came back as the answer, which I'm pretty sure stands for True.

Still, when closing the front end when logged on as a User and not an
Administrator, compacting does not occur because I don't see any message in
the status bar saying that compacting is or has occurred.

The code works without a problem when logged on as an administrator.

I am totally stumped and have no idea what the problem could be.

Thanks for any help.

--
Message posted via http://www.accessmonster.com
Nov 13 '05 #1
1 4813
Robert:

One thing you may want to check is whether the Users group has Open/Run and
Open Exclusive permissions on the database. You can check this through the
Tools/Security/User and Group Permissions option.

--
David Lloyd
MCSD .NET
http://LemingtonConsulting.com

This response is supplied "as is" without any representations or warranties.
"robert demo via AccessMonster.c om" <fo***@nospam.A ccessMonster.co m> wrote
in message news:ba******** *************** *******@AccessM onster.com...
In my startup routine, I have the following code:

s = CLng(FileLen(fi lespec) / 1000000)

If s > 5 Then

'FIRST, BACKUP THE FRONT END
If BackupFrontEnd = False Then
Exit Function
End If

'Now set the autocompact at close
Application.Set Option ("Auto Compact"), 1 'compact app
Else
Application.Set Option ("Auto Compact"), 0 'no don't compact app
End If

s is the size of the front end in MB. BackupFrontEnd is a function that
first backups the front end. It is working fine.

The idea is if the front end gets beyond a certain size (set to 5 MB here
for testing), the compact on close option is to be set so that when the
user closes the front end it will compact. I don't want to compact after
every close.

Here's the problem. It works fine if a user is an administrator. I can
verify that compacting occurs upon closing the front end by looking at the
status bar. If the user is part of the Users group, however, then
compacting does not occur. I have stepped through the code when logged on
as a regular user. The code definately sets the Auto Compact Option to 1. I
then double checked by typing in the Immediate Pane:

?Application.Ge tOption ("Auto Compact")

-1 came back as the answer, which I'm pretty sure stands for True.

Still, when closing the front end when logged on as a User and not an
Administrator, compacting does not occur because I don't see any message in
the status bar saying that compacting is or has occurred.

The code works without a problem when logged on as an administrator.

I am totally stumped and have no idea what the problem could be.

Thanks for any help.

--
Message posted via http://www.accessmonster.com
Nov 13 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

35
17010
by: Mike MacSween | last post by:
Is it?
13
5059
by: James Franklin | last post by:
Hi, I have a number of databases in A2K, written on different machines with different installations of Office. I have found that compacting a database while it is open regularly fails, seemingly at random. This is especially annoying as I usually set the Compact on Close setting in Tools/Options to true. Has anyone else experienced this...
13
10404
by: Larry L | last post by:
Access is noted for bloating a database when you add and delete records frequently. I have always had mine set to compact on close, and that works great. Now after everyone's advice I split my database, so the data is in a second (back-end) database with all the tables linked. However, now when I close the database, it compacts the front end,...
1
2277
by: ColinWard | last post by:
Hello everyone. happy new year. I am trying to code an exit button for my application so that it automatically compacts the database when the user exits the app. Is this necessary or does the "Compact on close" option work even when the database window is not displayed? Is it best to "roll my own" or not? My second question is what are...
3
2369
by: Trevor Hughes | last post by:
Hello All I have a database (Access 2000, running on Win 2000), which suffers from bloat over a period of time. In order to solve the problem I set the option to compact on exit. This however has caused a problem. The permissions of the mdb file which are set to Everyone-Full control, are reset when the database is compacted. The end...
1
2088
by: smitty mittlebaum | last post by:
I have a strange problem that has reared its ugly head in the last few weeks. I have the option "Compact on Close" (Tools, Options, General tab) enabled on my development machine. I did this because every time I worked on my app it just grew and grew. What started out as a 14Meg file kept growing into a monster of over 90 Megs! System...
1
4942
by: Mark | last post by:
Hi all, I have a Access 2002 FE/BE scenario where the BE is stored on a network drive. Due to the amount of importing/deleting, the database bloats quite a lot. UP until now, I have been booting the users out of the database and manually compacting it. What I am trying to do is automate the process so I don't have to worry about it. My VB...
3
2168
by: G Gerard | last post by:
Hello The more I use an application ( an mdb) created using MSAccess I notice that the Byte size of the application keeps on increasing. Once in a while I do a Compact and Repair Database (under Tools in MSAccess) on the application and the size then returns to normal.
29
2754
by: Neil | last post by:
I would like to compact on close only if the database size goes over a certain amount, rather than each time. Thus, I'd like to check the file size and then perform the compact through code as the mdb's closing. Is that possible? I suppose one option would be to set the Compact On Close option in the switchboard's On Close event, and then...
0
7700
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7924
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8125
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7676
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7974
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6284
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5513
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5219
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
938
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.