|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
||||
|
||||
|
open Access database for exclusive use
Hi,
I have an Access database used by 2 users who connect to it from a VB app using ADO. I want to prevent them working on it at the same time - display a message saying 'the database is busy try later'. I open the ADO connection in Mode=Share Exclusive. Even though there is an ldb lock file both users access the database at the same time! Any ideas? Thanx Last edited by shafan : August 14th, 2003 at 07:14 AM. |
|
#2
|
|||
|
|||
|
You might try a batch file
Kind of hokey, but I use this technique often in Windows. Write a batch file that detects whether the .ldb file exists. If it does, tell the user to try again later.
Untested code that I'll just type: echo off rem This batch file detects whether a file rem exists. If it does, it exits. If it rem doesn't it executes access. if exist (filename).ldb goto fail msaccess.exe (filename).mdb parameters goto end fail: cls echo Access currently in use. Try again later! end: I often use a batch file to detect newer versions of the front-end so that I don't have to wander around installing it every time I fix a bug. Good luck! |
|
#3
|
||||
|
||||
|
that's exactly how I've solved it (not with a batch but with the Dir function).
The problem is that if Access crashes the ldb file isn't removed and therefore the application 'thinks' a user is loged on. Last edited by shafan : August 10th, 2003 at 06:52 AM. |
|
#4
|
||||
|
||||
|
Your only real solution
is to upgrade to a real database.
__________________
Left DevShed May 28, 2005. Reason: Unresponsive administrators. Free code: http://sol-biotech.com/code/. Secure Programming: http://sol-biotech.com/code/SecProgFAQ.html. Performance Programming: http://sol-biotech.com/code/PerformanceProgramming.html. It is not that old programmers are any smarter or code better, it is just that they have made the same stupid mistake so many times that it is second nature to fix it. --Me, I just made it up The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man. --George Bernard Shaw |
|
#5
|
||||
|
||||
|
In the commandline you can append the database file name (xxx.mdb) with "/excl" to make it open exclusively.
|
|
#6
|
||||
|
||||
|
Thanx, but I connect to the database using ODBC from a VB app and don't use a command line
|
![]() |
| Viewing: Dev Shed Forums > Databases > Database Management > locking Access database for exclusive use |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|