Solved

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

Posted on 2014-03-08
9
524 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 26

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
 
LVL 26

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
Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

 
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 34

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

Free Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

Join & Write a Comment

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

746 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now