473,513 Members | 2,709 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Compact backend database, taking logged in users into account on Exit

547 Contributor
I currently use the following code to manually compact a backend database from a desktop icon now and then, when it gets a bit "bloated"
Expand|Select|Wrap|Line Numbers
  1. "C:\Program Files\Microsoft Office\Office12\MSACCESS.EXE" "C:\pisprg\Pisdatav2.accdb" /compact
It would be very nice to add vba code to the application's "exit" button, that will look at the linked BE files and whether another pc is logged into the BE (and warn me), and then compact it accordingly.
I assume this can only happen when nobody is logged into the system from another pc, as that is how i currently do it.
Any suggestions?
Jan 8 '13 #1
2 1590
Rabbit
12,516 Recognized Expert Moderator MVP
You can check for the existence of the lock file. Although I've heard that is not completely reliable because sometimes it doesn't delete the lock file when there's no one in the database.
Jan 8 '13 #2
NeoPa
32,557 Recognized Expert Moderator MVP
So many questions today I almost missed this one after it scrolled off the screen :-(

I've always found it entirely safe to attempt to delete the LDB file of an Access database. A lock file (LDB) is always maintained open by the version of Access using it, so an attempt will only ever succeed when no users currently have the MDB or ACCDB open. Clearly, before attempting to delete it, determine that it even exists (as Rabbit said), but if it does exist then try to delete it before assuming the (M/ACCDB) file is actually in use.

PS. Dir() can tell you if a file exists and Kill will attempt to erase it for you. We'll assume you know enough to continue unless you indicate otherwise.
Jan 9 '13 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
2585
by: Marcin Zmyslowski | last post by:
Hello all! I want to create a page in ASP language which gives me information about currently logged users. I thought to do it by this way: when somebody will log in to page, there will be a...
11
4487
by: HB2 | last post by:
I am using the Linked Table Manager in Access to try and connect my front end database (on my desktop) to my backend database (on my web host) I get an invalid name error. Any help much...
2
1920
by: barbara_dave | last post by:
Hi, All, I have an existing access database. It can't be added more data and its size is 32mb. I wonder it is full. I use access utilities to repair and compact it, but I got error message...
4
1855
by: Wayne | last post by:
I have a backend database (Backend1.mdb)that has 3 main data tables, I'll call them Data1, Data2 and Data3, plus several other associated tables. All relationships are set in the backend database...
2
2988
by: Brian P. Hammer | last post by:
All, How do I go about compacting an Access XP database from VB code? I use a database for various reporting information and records are often deleted and created. The size of the database can...
0
1572
by: Scott | last post by:
I need to compact the backend database on server regularly using Jetcomp utility. Can this utility support commandline so I can do it with Windows scheduler. Your advice on the syntax is...
3
2942
by: theProfessor | last post by:
We are using a shared split database with all users currently using Access 2003. The back end is on a shared drive of a state wide WAN. Each user has a copy of the front end on their local...
2
1821
by: catherine | last post by:
Hi, I am trying to work out how I can disable / enable **another** users Active Directory account not my own via C#. If I create a directory entry like so I need to know the other users password...
2
2584
by: BinaryGirl23 | last post by:
Hello, I'm having a bit of a problem regarding my back-end database for Access 2003. The db is set for shared mode, has no programming code at all, only back-end tables that is shared on our...
13
6710
by: snowinfo | last post by:
Hi all, any way to count the number of users i have logged into my site? any help/code appreciated, craig
0
7254
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,...
0
7153
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7432
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...
0
7519
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...
0
5677
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,...
0
4743
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...
0
3230
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3218
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
796
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.