-
Hey
Is it possible to kick all users and open the database exclusive (the users are already using the database)? The problem is this :
If / when the database gets corrupt some of the users can still continue to work on while others can't logon at all. If there is such a function it would be nice to be able to kick all users and repair it and the re-open it, is it possible at all ? ?
//Patrick
-
It's naughty but if you delete the .LDB file in the same directory as the .MDB file you'll find nobody is locking the database any more...
-
THAT is Naughty
but unfortunatly it doesn't work, if you try removing it windows give you a file error. The file is already in use by someone else (alas you can't delete it). This ain't because someone is using it RIGHT now, windows always gives you this error.....
//Patrick
-
As far as I know they're is no easy way of doing this.
First of all you have to know what users are in the mdb. So you problably have to do something with a login screen and keep track of who is logged in.
I use a 'user-table' for this in which all users are stored and a flag is set to True if the user logs in.
With this table, I can see who is logged into the app (and the database(s) it is using). If I want to kick someone out, I let the application put a small, hidden file with name <userid> in the datadirectory. I let the application check every 30 seconds for a file called <userid>. If found, I let the app display a message that there session will be closed in a minute. After that minute the app disconnects all connections from there instance of the App to the database, removes the <userid> file, sets the login flag in the usertable to false and shuts itself down.
I use the same trick with a hidden file in the datadirectory to lock an application for database maintenance or whatever.
I'm sure there must be better ways, but this works fine for me.
-
how about a single user?
Is it possbile then (from access or vb) to exclude (kick) a user (if you know that he's in the database and you know his id) if he's currently accessing access? Or must you exit your application ?
(sorry for posting new thread - pressed the wrong button :)
//Patrick
-
I don't think it'll be possible to disconnect users from the database from VB. In my opinion, you should use Operating System's tools, to discover who is connected to the mdb and then disconnect them.