Results 1 to 6 of 6
  1. #1
    New Lounger
    Join Date
    Mar 2002
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Time out a db (2000)

    I am trying to figure out how to "Time Out" my db. I would like after a certain date for the db not to open anymore and a message box to pop up. I am not sure where to even start. I have been looking through my Access books- but they are very limited. I am new to writing code and have been only working with access for less than a year. Could I also have a Password so that I can unlock it after "that date" Thanks for the help!

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Time out a db (2000)

    Create this function in a module:
    <pre>Function CloseDb()
    If Date < #2/2/2003# Then
    MsgBox "Db is not any more available"
    Application.Quit
    Else
    ' Code to do what you want.
    End If
    End Function</pre>

    Replace #2/2/2003# with your date.
    Create a macro that you name AutoExec, with the following action:
    RunCode
    Function name : CloseDb()
    This will not prevent the user to open the db with the shift key.
    Francois

  3. #3
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Time out a db (2000)

    This depends on how serious you are. Most such attempts within Access can be circumvented one way or another. There are some products out there that specifically give this sort of flexibility; like allowing a program to be executed a certain # of times or for a certain # of days. Unfortunately, I can't remember the names of these products/companies, but you can probably find them by doing a Google search using topics like: security, shareware, demos, etc.
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  4. #4
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Time out a db (2000)

    You can do it, but this is fairly advanced coding, and the method I'm familiar with requires Access security, a separate license file, registry keys and a scheme for encrypting and decrypting the license key. If you're writing in 2000, you can hard code a date into the VBA, as Francois suggests, and then password protect the code. For yourself, you might want to keep a copy that's open (without the hardcoded date), but you can also establish a "back door" into the application by building it to accept a command line argument to tell it to ignore the date.
    Charlotte

  5. #5
    New Lounger
    Join Date
    Mar 2002
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Time out a db (2000)

    Thanks- that Macro worked! But now I am trying to reassign the Shift key with an AutoKeys Macro, So that if they try to open the db with the shift key it does not open. I am not having any luck. I tried to use the + sign in the Macro Name coulum to reassign the shift key to Quit the application, but it said improper syntex. I tried reassigning other keys to quit application, and they worked. How do I reassign the shift key? Thanks for all your help.

  6. #6
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Time out a db (2000)

    It won't work anyhow. The AutoKeys macro doesn't run until the database is opened. Opening it with a shiftkey held down bypasses running AutoKeys. What you do is disable it in code by turning off the AllowBypassKey property. You can find sample code in on-line help by typing "AllowBypassKey property" into the search wizard in Help.
    Charlotte

Posting Permissions

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