Solved

How create a "demo" database which would timeout after a certain time period

Posted on 2014-03-08
9
533 Views
Last Modified: 2014-03-10
Is there a way to create a demo database in Access 2010 that would become not useable after a certain length of time?
0
Comment
Question by:SteveL13
9 Comments
 
LVL 10

Accepted Solution

by:
Korbus earned 84 total points
ID: 39914949
You probably have an autoexec startup macro already in place, if not, set one up.  In this macro, look up the “expiration date” in a table, or hard code it in.  If the current date is later than the expiration date; open up an “expired” message box, rather than your main form.  You could also delete certain forms or queries at this point; so they can’t just change their computer date once they see the “expired” message.  (Let us know if you need more details on how to do this stuff.)
Of course, this will not stop any determined, advanced user.  For that you must prevent the user from modifying the auto-exec macro, and the expiration date table.  Unfortunately access user security has changed in I used access a lot, and I’m not really up to speed on it anymore.  But I’m sure another expert will have some input on this.
0
 
LVL 27

Expert Comment

by:MacroShadow
ID: 39914959
I imagine it would be for licensing purposes...

The only way to effectively do so is to hard code the expiring date. Then every time the database is opened you can check the current date and if it is larger than than expiring date close the program.

Note:
1. The database has to be compiled (accde or ade), otherwise the code can be tampered with (even if you set a vba project password it can easily be cracked).
2. The users can change the date of their computer, so to effectively work you will have to compare the time with an online time server.
0
 

Author Comment

by:SteveL13
ID: 39914971
So I suppose I could do an onopen event of the form that opens when the database is launched.  I could have a Dlookup in the onopen event to lookup an expiration date and compare it to the today's date.

But then for today's date how would I lookup an online time server?
0
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 
LVL 27

Assisted Solution

by:MacroShadow
MacroShadow earned 84 total points
ID: 39915035
I found this here:

Option Explicit

Function InternetTime(Optional GMTDifference As Integer) As Date

    '-----------------------------------------------------------------------------------
    'This function returns the Greenwich Mean Time retrieved from an internet server.
    'You can use the optional argument GMTDifference in order to add (or subtract)
    'an hour from the GMT time. For Example if you call the function as:
    '=InternetTIme(2) it will return the (local) hour GMT + 2. Note that the
    'GMTDifference variable is an integer number.
   
    'Written by:    Christos Samaras
    'Date:          25/09/2013
    'Last Updated:  20/11/2013
    'e-mail:        xristos.samaras@gmail.com
    'site:          http://www.myengineeringworld.net
    '-------------------------------------------------------------------------------

    'Declaring the necessary variables.
    Dim Request     As Object
    Dim ServerURL   As String
    Dim Results     As String
    Dim NetDate     As String
    Dim NetTime     As Date
    Dim LocalDate   As Date
    Dim LocalTime   As Date
   
    'Check if the time difference is within the accepted range.
    If GMTDifference < -12 Or GMTDifference > 14 Then
        Exit Function
    End If

    'The server address.
    ServerURL = "http://www.timeanddate.com/worldclock/fullscreen.html?n=2"
   
    'Build the XMLHTTP object and check if was created successfully.
    On Error Resume Next
    Set Request = CreateObject("Microsoft.XMLHTTP")
    If Err.Number <> 0 Then
        Exit Function
    End If
    On Error GoTo 0
   
    'Create the request.
    Request.Open "GET", ServerURL, False, "", ""
   
    'Send the request to the internet server.
    Request.Send
   
    'Based on the status node result, proceed accordingly.
    If Request.ReadyState = 4 Then
       
        'If the request succeed, the following line will return
        'something like this: Mon, 30 Sep 2013 18:33:23 GMT.
        Results = Request.getResponseHeader("date")
       
        'Use the Mid function to get something like: 30 Sep 2013 18:33:23.
        Results = Mid(Results, 6, Len(Results) - 9)
       
        'Use the Left and Right function to distinguish the date and time.
        NetDate = Left(Results, Len(Results) - 9) '30 Sep 2013
        NetTime = Right(Results, 8) '18:33:23
       
        'Convert the date into a valid Excel date 30 Sep 2013 -> 30/9/2013.
        'Required for countries that have some non-Latin characters at their alphabet (Greece, Russia, Serbia etc.).
        LocalDate = ConvertDate(NetDate)

        'Add the hour difference to the retrieved GMT time.
        LocalTime = NetTime + GMTDifference / 24

        'Return the local date and time.
        InternetTime = LocalDate + LocalTime
   
    End If
   
    'Release the XMLHTTP object.
    Set Request = Nothing

End Function

Function ConvertDate(strDate As String) As Date

    '-------------------------------------------------------------------------
    'This function converts the input date into a valid Excel date.
    'For example the 30 Sep 2013 becomes 30/9/2013.
    'Required for countries that have non-Latin characters at their alphabet.

    'Written by:    Christos Samaras
    'Date:          25/09/2013
    'e-mail:        xristos.samaras@gmail.com
    'site:          http://www.myengineeringworld.net
    '-------------------------------------------------------------------------

    'Declaring the necessary variables.
    Dim MyMonth As Integer

    'Check the month and convert it to number.
    Select Case UCase(Mid(strDate, 4, 3))
        Case "JAN": MyMonth = 1
        Case "FEB": MyMonth = 2
        Case "MAR": MyMonth = 3
        Case "APR": MyMonth = 4
        Case "MAY": MyMonth = 5
        Case "JUN": MyMonth = 6
        Case "JUL": MyMonth = 7
        Case "AUG": MyMonth = 8
        Case "SEP": MyMonth = 9
        Case "OCT": MyMonth = 10
        Case "NOV": MyMonth = 11
        Case "DEC": MyMonth = 12
    End Select

    'Rebuild the date.
    ConvertDate = DateValue(Left(strDate, 2) & "/" & MyMonth & "/" & Right(strDate, 4))

End Function

Open in new window

0
 
LVL 57

Assisted Solution

by:Jim Dettman (Microsoft MVP/ EE MVE)
Jim Dettman (Microsoft MVP/ EE MVE) earned 83 total points
ID: 39915042
There are so many in's and out's to this, I would not suggest re-inventing the wheel, but rather:

http://www.peterssoftware.com/ka.htm

  But as the others have said, you'll need some kind of check, but don't place it in the autoexec, which can be bypassed.

 Place you check in code, and you'll need to distribute as a MDE, or put a password on the VBA project.

 The check/restriction may take any number of forms:

1. Expiration date
2. Limit the number of records allowed in key table (ie. can only enter five customers).
3. Limit number of users
4. Tie to a specific hard drive
5. Don't allow the company name to be changed and print it out on all reports "DEMO DB - NOT FOR COMMERCIAL USE".

Jim.
0
 
LVL 35

Assisted Solution

by:PatHartman
PatHartman earned 83 total points
ID: 39915156
I create a "token".  Mine is 16 digits and in addition to the expiration date includes other flags to turn on/off application features.  I also use a check digit which makes it more difficult to randomly come up with a working code.  The check digit is never the first or last character since those positions are too obvious and the date is never mmddyy all together, the characters are spread around in some different order.  I use different conversion schemes for different positions so pos 4 which might be the day part of the expiration month uses 31 characters from the set of a-z, A-Z, and 0-9.  I generally omit zero and the letters O, l, and I.  So, I create an array using 31 of those characters in a random order.  Day 1 is array(1), day 2 is array(2), etc.  I use a 1 based array for my sanity.

This method allows you to send the client a new token with a different expiration date if he purchases or renews.  It does not prevent multiple installs though.  You need something like the product sold on Peter's Software site.  This works for my software because it is business specific and not something that people are inclined to share with each other.  Plus, I price the product to account for multiple installs.
0
 
LVL 84

Assisted Solution

by:Scott McDaniel (Microsoft Access MVP - EE MVE )
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 83 total points
ID: 39915688
I've used this:

http://www.ssware.com/cryptolicensing/cryptolicensing_ocx.htm

I have the .NET and ActiveX versions, and they work very well, and are easy to use and deploy. It provides standard licensing schemes (i.e. number of uses, expiration date, etc etc) and includes logic to detect date rollbacks and such. It can be tied to a specific machine, or you can create one that will allow your program to be installed x number of times.
0
 
LVL 45

Assisted Solution

by:aikimark
aikimark earned 83 total points
ID: 39916478
1. You need to persist the form and report open/close datetime values.  Logging is generally useful for debugging.  The event log should be hidden and the data lightly encrypted with a key specific to each user/PC.

2. If the database is opened read-only, prevent anything useful from happening.

3. If possible, externalize something that will help you know that the expiration date has been passed.

4. Use Nag Screens to remind your users that the demo/lease is set to expire in a few days.  I start showing these about two weeks out.

5. Facilitate the extension of the demo/lease period with a license file.
0
 

Author Closing Comment

by:SteveL13
ID: 39917314
Thank you to all of you who provided extremely great input.  I appreciate it.
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question