Results 1 to 8 of 8
  1. #1
    Join Date
    May 2006
    Posts
    65

    Unanswered: Lock mdb once it's opened

    Hi all,

    i have an mdb me and my colleague use- ive had to invoke some code at start up to ensure my colleague always works with refreshed data but cant stop him from opening it up whilst im using it- doesn't matter how many times i say ask before you open i find it gets opened when im running code and by opening another instances triggers the code that runs on start and subsequently crashes and corrupts our data.

    therefore i need to set the db so if one of use has it open the other cant access it, the obvious thing would be to tell my colleqgue that if he sees the lock file he shouldn't open it- but if he listened to me in the first place i would be writing this.

    therefore i can lock the mdb so when i have it oepn it will not allow another instance to be opened?

    greg

  2. #2
    Join Date
    Jul 2003
    Location
    Michigan
    Posts
    1,941
    When you go to File->Open the "open" button contains several options.
    Use Open Exclusive.
    Inspiration Through Fermentation

  3. #3
    Join Date
    May 2006
    Posts
    65
    hi yeah i thought of that but dont open via an open dialog box- i sue shortcuts...was wondring if i could use vb to fire a msgbox to a user if an instance is already open-- maybe get the vb to look for the lock file or something...

    may seem overkill but i simply cannot stop my colleague opening the file when im in it, he just doesn't listen.

    greg

  4. #4
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    if you use shortcuts then you may be able to use a command line switch to open it in exclusive mode, you wold then need to 2 shortcuts (one for normal use, oine for exclusive use

    putting "command line switch access exclusive microsoft" in google came up with a usefull refeence on this topic
    I'd rather be riding on the Tiger 800 or the Norton

  5. #5
    Join Date
    May 2006
    Posts
    65
    nice one - will look into that

    greg

  6. #6
    Join Date
    May 2006
    Posts
    65
    you cant use command lines within shortcuts. any other ideas?

    greg

  7. #7
    Join Date
    Jul 2003
    Location
    Michigan
    Posts
    1,941
    You can in a batch file, though! Here's part of what's in a .bat file that
    I use to open my APP with a specific workgroup file:

    "c:\program files\Microsoft Office\Office10\MSACCESS.EXE" "c:\program files\planning system\prod_plan.mdb" /wrkgrp "H:\USERS\LOGISTIC\PLANNING SYSTEM\PROD_PLAN.MDW"

    You would, of course, change everything to your files and paths, and change the wrkgrp switch to the exclusive switch (whatever that looks like),
    and then point your shortcut to the .bat file.
    Inspiration Through Fermentation

  8. #8
    Join Date
    May 2006
    Posts
    65
    ah i was doing something wrong, ive managed to actuially put the command in the shortcut so all is sorted:

    1. Open the folder where Microsoft Access is installed (located by default in C:\Program Files\Microsoft Office\Office11).
    2. Right-click the Microsoft Access program icon, and then click Create Shortcut.
    3. Right-click the shortcut icon just created, click Properties, and then click the Shortcut tab.
    4. Click to the right of the Microsoft Access startup command in the Target box, and then type the desired command-line options.

    For example, the following command line starts Microsoft Access and opens the Northwind sample database for exclusive (exclusive: A type of access to data in a database that is shared over a network. When you open a database in exclusive mode, you prevent others from opening the database.) access.

    "C:\Program Files\Microsoft Office\Office11\MSAccess.exe" "C:\Program Files\Microsoft Office\Office11\Samples\Northwind.mdb" /excl

    cheers

    greg

Posting Permissions

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