Make Ms access database trial version (1 Viewer)

I am alive

Member
Local time
Today, 16:12
Joined
Aug 29, 2020
Messages
139
Hi all. How can I make my database to be a trial version to automatically shut down after 15 days
 

Ranman256

Well-known member
Local time
Today, 09:12
Joined
Apr 9, 2015
Messages
4,339
program an end date into the code, and a table to save date & and a flag that it ended so it never works again.
lock down the db so users cant edit, or save as mde.

tConfig table
[EndDate],[HasEnded]
2/1/2022 , false

macro AUTOEXEC runs function:
RunCode: Startup()

Code:
public function Startup()
dim vEndDate as date
dim bAllow as boolean

vEndDate = Dlookup("[EndDate]","tConfig")

  'turn off trial
if Date() > vEndDate then
   docmd.SetWarnings false
   docmd.runsql "Update tConfig set [HasEnded]=true"
   docmd.SetWarnings true
endif
bAllow = Dlookup("[HasEnded]","tConfig") = false

   'allow user in?
if Date() < vEndDate and bAllow then
   docmd.OpenMainMenu
else
  msgbox "Trial has ended."
  docmd.quit
endif
end function
 

GPGeorge

Grover Park George
Local time
Today, 06:12
Joined
Nov 25, 2004
Messages
1,775
Hi all. How can I make my database to be a trial version to automatically shut down after 15 days
Unfortunately, even if you DO convert to an accde, users can get to the tables. How hard is it to modify a record in a table to reset the trial period?
You can try hiding the config table, even using a deep hide approach, so that it is harder to do. Not impossible, harder.

You could look into so more formal approaches. I believe isladogs has some information about licensing on his website.
 

I am alive

Member
Local time
Today, 16:12
Joined
Aug 29, 2020
Messages
139
program an end date into the code, and a table to save date & and a flag that it ended so it never works again.
lock down the db so users cant edit, or save as mde.

tConfig table
[EndDate],[HasEnded]
2/1/2022 , false

macro AUTOEXEC runs function:
RunCode: Startup()

Code:
public function Startup()
dim vEndDate as date
dim bAllow as boolean

vEndDate = Dlookup("[EndDate]","tConfig")

  'turn off trial
if Date() > vEndDate then
   docmd.SetWarnings false
   docmd.runsql "Update tConfig set [HasEnded]=true"
   docmd.SetWarnings true
endif
bAllow = Dlookup("[HasEnded]","tConfig") = false

   'allow user in?
if Date() < vEndDate and bAllow then
   docmd.OpenMainMenu
else
  msgbox "Trial has ended."
  docmd.quit
endif
end function
Thanks so much
 

I am alive

Member
Local time
Today, 16:12
Joined
Aug 29, 2020
Messages
139
program an end date into the code, and a table to save date & and a flag that it ended so it never works again.
lock down the db so users cant edit, or save as mde.

tConfig table
[EndDate],[HasEnded]
2/1/2022 , false

macro AUTOEXEC runs function:
RunCode: Startup()

Code:
public function Startup()
dim vEndDate as date
dim bAllow as boolean

vEndDate = Dlookup("[EndDate]","tConfig")

  'turn off trial
if Date() > vEndDate then
   docmd.SetWarnings false
   docmd.runsql "Update tConfig set [HasEnded]=true"
   docmd.SetWarnings true
endif
bAllow = Dlookup("[HasEnded]","tConfig") = false

   'allow user in?
if Date() < vEndDate and bAllow then
   docmd.OpenMainMenu
else
  msgbox "Trial has ended."
  docmd.quit
endif
end function
It works perfectly. Thanks so much
 

theDBguy

I’m here to help
Staff member
Local time
Today, 06:12
Joined
Oct 29, 2018
Messages
21,357
It works perfectly. Thanks so much
Just don't get comfortable with it, I guess, if that's the only restriction you implemented in your app; because as @GPGeorge said, it's very easy to circumvent. Good luck!
 
Last edited:

CJ_London

Super Moderator
Staff member
Local time
Today, 13:12
Joined
Feb 19, 2013
Messages
16,553
rather than storing in a table, store it as a property, can still be found by someone with the appropriate skills but safer than a table. Code perhaps something like this to run in the open event of the first form to open - this is aircode so might need adjusting

Code:
Form_Open()
Dim prp As Property

on error goto errctl 'in case property does not exist

set prp=currentdb.properties("openOK")
if clng(date())>=prp then
    msgbox "trial period expired", vbok 
    docmd.quit
end if

'rest of your form open event code here, if any

exit sub

errctl:

    Set prp = currentdb.CreateProperty("openOK", dbLong, clng(date())+15)
    currentdb.Properties.Append prp
    resume next

End Sub
 

GPGeorge

Grover Park George
Local time
Today, 06:12
Joined
Nov 25, 2004
Messages
1,775
rather than storing in a table, store it as a property, can still be found by someone with the appropriate skills but safer than a table. Code perhaps something like this to run in the open event of the first form to open - this is aircode so might need adjusting

Code:
Form_Open()
Dim prp As Property

on error goto errctl 'in case property does not exist

set prp=currentdb.properties("openOK")
if clng(date())>=prp then
    msgbox "trial period expired", vbok
    docmd.quit
end if

'rest of your form open event code here, if any

exit sub

errctl:

    Set prp = currentdb.CreateProperty("openOK", dbLong, clng(date())+15)
    currentdb.Properties.Append prp
    resume next

End Sub
You could further obscure it by using a nonsense string instead of "openOK" for the property name.
 

isladogs

MVP / VIP
Local time
Today, 13:12
Joined
Jan 14, 2017
Messages
18,186
If you are going to do this, I also suggest you do it properly. Otherwise, it isn't worth doing at all in my opinion...

It would take a matter of seconds to circumvent the trial period end either by changing the system date or by changing the table data.
Using a property would certainly be better or you could add an obscure registry entry.
I would also suggest adding additional security to backup whatever approach you use.

Also, if/when customers purchase your app after the trial period, you need to consider how you can protect against it being used on more workstations than the number of licenses purchased.
 

Cotswold

Active member
Local time
Today, 13:12
Joined
Dec 31, 2020
Messages
521
When I applied this sort of security, I would also link the date restriction to user entries. Then if the system date was wound back the security would still work and prevent use. Usually there is little benefit if any transactions and invoices cannot advance beyond a date set. The user would enter the dates required and when the the system saved the record it would write the dates back to the end date set. Even if they amended them in the tables, when it started up the next time any advanced dates would be written back to their end date before closing down.

I wouldn't give an error message that the program was out of date, in case some propeller-head located it in the modules. The program simply wouldn't start up again the next time. Any support call wondering why it didn't work was an easy one to answer. Particularly if copies had been passed on to others.
 

GPGeorge

Grover Park George
Local time
Today, 06:12
Joined
Nov 25, 2004
Messages
1,775
When I applied this sort of security, I would also link the date restriction to user entries. Then if the system date was wound back the security would still work and prevent use. Usually there is little benefit if any transactions and invoices cannot advance beyond a date set. The user would enter the dates required and when the the system saved the record it would write the dates back to the end date set. Even if they amended them in the tables, when it started up the next time any advanced dates would be written back to their end date before closing down.

I wouldn't give an error message that the program was out of date, in case some propeller-head located it in the modules. The program simply wouldn't start up again the next time. Any support call wondering why it didn't work was an easy one to answer. Particularly if copies had been passed on to others.
Out of curiosity, to those who've implemented trial periods and licensing for Access-based relational database applications, how frequently have you encountered or been aware of attempts to bypass restrictions? Is it possible to even know or estimate that? I ask because it seems like a lot of time and energy could go into solving a problem that isn't egregious. I guess if you sell ten licenses and discover that the application is installed 20 times, that's a big problem. If you sell a thousand licenses and learn that the application is installed 1,020 times, that's a problem, but much smaller.

Realistically, is it worth investing in commercial grade licensing software or should people rely on the things that Access can support more or less natively?
 

MarkK

bit cruncher
Local time
Today, 06:12
Joined
Mar 17, 2004
Messages
8,178
The genius of Access is how quick and easy it is to customize. What I recommend, rather than writing that silver bullet system and securing the crap out of it, is this: write a simple, free, unsecured sample, so people can come to see how awesome you really are as a programmer. Then, convince them to hire you to customize your simple, free, unsecured sample. You trust them. They trust you. You build a relationship. They repeatedly call you back to update your awesome work as their business rules change and grow.

My contention is that as an Access programmer, your biggest monetary loss is obscurity, not theft. As a result, write something widely distributed so people can start to learn your name. Write something that everyone wants you to customize for them. Then, customize it to exactly fit the business problem they need solved.

That is that genius of Access.
 

isladogs

MVP / VIP
Local time
Today, 13:12
Joined
Jan 14, 2017
Messages
18,186
I really couldn't have put it better and that has been my main approach for many years.

I have used various trial/evaluation/demo versions with some success.
AFAIK, none of them have been cracked or pirated ...but then, how would I find out? Who is going to tell me?

BUT as already stated, if you are going to do this, do it properly...or not at all
 

theDBguy

I’m here to help
Staff member
Local time
Today, 06:12
Joined
Oct 29, 2018
Messages
21,357
I came across a business man who had licensing restrictions in his Access product. He told me he discovered some of his clients were able to extend their licenses (can't remember how or for how long). He asked me to help him find a better way to control user access. The solution I recommended to him was to move his licensing feature into a web server. That way, users won't be able to mess with it.
 

I am alive

Member
Local time
Today, 16:12
Joined
Aug 29, 2020
Messages
139
rather than storing in a table, store it as a property, can still be found by someone with the appropriate skills but safer than a table. Code perhaps something like this to run in the open event of the first form to open - this is aircode so might need adjusting

Code:
Form_Open()
Dim prp As Property

on error goto errctl 'in case property does not exist

set prp=currentdb.properties("openOK")
if clng(date())>=prp then
    msgbox "trial period expired", vbok 
    docmd.quit
end if

'rest of your form open event code here, if any

exit sub

errctl:

    Set prp = currentdb.CreateProperty("openOK", dbLong, clng(date())+15)
    currentdb.Properties.Append prp
    resume next

End Sub
Good. Thank you very much. God bless you
 

I am alive

Member
Local time
Today, 16:12
Joined
Aug 29, 2020
Messages
139
rather than storing in a table, store it as a property, can still be found by someone with the appropriate skills but safer than a table. Code perhaps something like this to run in the open event of the first form to open - this is aircode so might need adjusting

Code:
Form_Open()
Dim prp As Property

on error goto errctl 'in case property does not exist

set prp=currentdb.properties("openOK")
if clng(date())>=prp then
    msgbox "trial period expired", vbok 
    docmd.quit
end if

'rest of your form open event code here, if any

exit sub

errctl:

    Set prp = currentdb.CreateProperty("openOK", dbLong, clng(date())+15)
    currentdb.Properties.Append prp
    resume next

End Sub
Hi. Is there any way you could change the date to limit the records added to a table. For example, if the user has entered 20 records then to be prompted "trial version expired". Thanks in advance.
 

GPGeorge

Grover Park George
Local time
Today, 06:12
Joined
Nov 25, 2004
Messages
1,775
Hi. Is there any way you could change the date to limit the records added to a table. For example, if the user has entered 20 records then to be prompted "trial version expired". Thanks in advance.
That would be subject to the same limitations already posted regarding the ability of users to bypass dates. You could write a VBA module to do that, and release the product as an accde, of course, and make it HARDER for people to bypass your license.
 

LarryE

Active member
Local time
Today, 06:12
Joined
Aug 18, 2021
Messages
562
You could use the following code for each form's Dirty Event:
Code:
Private Sub Form_Dirty(Cancel As Integer)
If Me.Form.CurrentRecord > 10 Then
    MsgBox Me.Form.CurrentRecord & " Exceeds Maximum Records Allowed"
    Me.Undo
    Me.AllowAdditions = False
End If
End Sub
In this case the limit is 10 records.
Then save the demo file as .accde to protect your code.
 

I am alive

Member
Local time
Today, 16:12
Joined
Aug 29, 2020
Messages
139
Thanks so
You could use the following code for each form's Dirty Event:
Code:
Private Sub Form_Dirty(Cancel As Integer)
If Me.Form.CurrentRecord > 10 Then
    MsgBox Me.Form.CurrentRecord & " Exceeds Maximum Records Allowed"
    Me.Undo
    Me.AllowAdditions = False
End If
End Sub
In this case the limit is 10 records.
Then save the demo file as .accde to protect your code.
Thanks so much
 

Users who are viewing this thread

Top Bottom