Results 1 to 6 of 6

Thread: Kick users from an .mdb

  1. #1

    Thread Starter
    Lively Member PatOls's Avatar
    Join Date
    Oct 2000
    Posts
    99

    Exclamation

    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

  2. #2
    Frenzied Member Buzby's Avatar
    Join Date
    Jan 1999
    Location
    UK
    Posts
    1,670
    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...

    'Buzby'
    Visual Basic Developer
    "I'm moving to Theory. Everything works there."

  3. #3

    Thread Starter
    Lively Member PatOls's Avatar
    Join Date
    Oct 2000
    Posts
    99

    Arrow 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

  4. #4
    Addicted Member LAURENS's Avatar
    Join Date
    Jan 2000
    Location
    Utrecht, the Netherlands
    Posts
    138
    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.

    Regards,
    Laurens

    Using VB5 Enterprise edition SP3
    VB6 Enterprise edition SP5

  5. #5

    Thread Starter
    Lively Member PatOls's Avatar
    Join Date
    Oct 2000
    Posts
    99

    Talking 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

  6. #6
    Lively Member
    Join Date
    Apr 2000
    Location
    Rafaela (Argentine)
    Posts
    107
    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.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width