Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2009

    Unanswered: help to disable databse

    Dear All,
    I have design one simple access database. Now I would like to disable my database after the specified date, so that nobody else can open the database after expiry date which I will set in database.

    Can anyone help me in this regards. It is very important for me.

  2. #2
    Join Date
    Mar 2009
    Provided Answers: 14
    Do you nedd to keep the database "as it is" or simply destroy it?

    Have a nice day!

  3. #3
    Join Date
    Nov 2007
    Adelaide, South Australia
    You'd have to code all the forms to look at the expiry date on opening and cancel if Date() is greater.
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!

    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  4. #4
    Join Date
    Dec 2004
    Madison, WI

    Locking a database after a date

    What I do is create a function in a module which takes care of things like this. I then call the function when the initial form opens.

    For example, the function might be like this:

    Public Function retReachedEndingDate() as boolean
    retReachedEndingDate = False 'first assume it to be ok
    Dim LookupEndDate as date
    LookupEndDate = Dlookup("[EndDate]","tblEndingDate") 'The table: tblEndingDate would have 1 field (called: EndDate or whatever you want to call it.) It would be the date you want to shut off the program. (only enter in 1 record! If you update it, overwrite the existing record.)
    If EndDate > Date() then
    retReachedEndingDate = true
    retReachedEndingDate = False
    end if
    End Function

    Then in the OnOpen event of my main background form (the form which only opens once when the mdb opens - hopefully you have a "background" type of form which then opens your other forms. See code bank for more info on this. It doesn't hurt to have it run several times if the form opens closes and opens again, etc... Anyway, it would be the form which is set to load on startup under Tools. Put this code in the In the OnLoad event of this form (look at the properties of the form.) Double-Click on the black area outside the details section to quickly see properties of the form:

    if retReachedEndingDate = true then
    msgbox "You have reached the time-limit to use this program. Contact...." (or show pop up form mentioned below).
    end if

    You could also put the function itself in the main form. I prefer to keep in the module section simply because I can then easily access it from any form.

    I'm assuming you'll have some way to activate the form for the user? My thought would be a simple form you implement which has the EndDate field on it (unbound with the default set to the date you want it to be.) Make the field locked = true and enabled = false (so they can't change it). Make a button which writes this to the EndDate field and then send them the form to import. OR you could also have a table which has 2 fields, VersionNum, EndDate. You could then get fancy and populate this table with different VersionNums (ie. 32ST44599T1) and a Date for each version. If you do the code right when designing the form, then in the future, you simply have them open the form and enter the new version number which will then write the corresponding Date to the EndDate field.

    There are many different ways. This is one of the more simplier ones. I'm assuming that you'd hide the LookupEndDate Table (and the VersioningTable if you're going that way) and make it an mde file so they can't see your code (but give them the mdb as a courtesy copy - just make a "Your advertisement form" as the main form which shows and doesn't allow them to get behind the scenes (unless they hire an actual dba who would know how.)

    I usually do something like this for versioning where I'll update a field to display the next version number (ie. the current date formatted in a version-type way.)
    Last edited by pkstormy; 08-25-09 at 23:32.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  5. #5
    Join Date
    Aug 2009
    Quote Originally Posted by Sinndho
    Do you nedd to keep the database "as it is" or simply destroy it?

    Have a nice day!
    Thanks for reply.

    I want to destroy d'base.

Posting Permissions

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