I am alive
Member
- Local time
- Today, 22:20
- 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
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
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?Hi all. How can I make my database to be a trial version to automatically shut down after 15 days
Thanks so muchprogram 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 muchprogram 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
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!It works perfectly. Thanks so much
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.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
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.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.
Good. Thank you very much. God bless yourather 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.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
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.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.
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
Thanks so muchYou could use the following code for each form's Dirty Event:
In this case the limit is 10 records.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
Then save the demo file as .accde to protect your code.