Stopping DB after "free trial" etc

Nigel,

The finish date is entered for the onClick line and stays there

The code that makes the table updates the MSysObjects system table and that date is used for the reference to the finish date on the OnClick line and you can't wind it back.

So for example lets say the finish date is 14/1/09 *86400 so that number goes to the OnClick line.

If the program is run today then the MSysObjects system table will get a new record for Now() and that value goes into a text box. The highest Now() is taken from the system table. Winding the computer back will just put a lower value Now() into the table but it is the highest that goes to the textbox.

The table created by the code is irrelevant except the creation of it prioduces the Now() for the system table.

I have now added this to the end of the code

DoCmd.DeleteObject acTable, "UsysEmail"

Thus that table won't ever been seen if they choose View System Objects.

I will play with it some more later today to see if I can defeat it.
 
Nigel,

This is the code I have run from an autoexec at the moment. You will see there are two forms and form UsysEmailer use the system table as its record source. Form Open Program has no record source so it just serves to establish that difference in dates and then to launch what the person has bought. So if the textbox is <0 then "no can go". One of the things i learnt was that if any object, noty just table, has Usys as the start of its name it will be hidden if System Files are not for view.

On Error Resume Next
DoCmd.DeleteObject acTable, "UsysEmail"
Dim dbs As Database, tbl As TableDef, fld As Field
Set dbs = CurrentDb
Set tbl = dbs.CreateTableDef("UsysEmail")
Set fld = tbl.CreateField("TrialDate", dbDate)
tbl.Fields.Append fld
dbs.TableDefs.Append tbl
dbs.TableDefs.Refresh
DoCmd.OpenForm "OpenProgram", acNormal, "", "", , acNormal
DoCmd.OpenForm "UsysEmailer", acNormal, "", "", , acNormal
DoCmd.GoToControl "DateUpdate"
DoCmd.RunCommand acCmdSortDescending
DoCmd.GoToRecord , "", acFirst

Forms!OpenProgram!TrialDate = Forms!UsysEmailer!DateUpdate
DoCmd.Close acForm, "UsysEmailer"

DoCmd.DeleteObject acTable, "UsysEmail"
 
Nigel,

I did a fair bit of testing. If you move the date well forward and run and then bring the date back again it loses the last date, although I was unbale to get to come back far enough so that -2 became 1 or whatever on the + So I am not 100%.

However, what I have decided to do and especially since the trial is short is:

1) Use a table with a name like USysSystem which means it will be hidden as a system object. In this table Date() will insert but with the condition that the entry already there is <= Date(). So that stops wind back ASSUMING they don't get to it. The finish date on the OnClick line.

2) I set the font to white and the column width to zero.

Another thing that could be done but I can't find a way to do it would be to change the Validation Rule for the Table Properties to False at the end of the code and return it to null at the start of the code so the entry from Date() could be made.
 
hi mike

I'm sure i read on here some were that if you hide the table using MSysObjects system , when the data base is compacted it will be deleted

i will search for the post later and put a link on here

regards
rob :)
 
Rob,

Just tried it manually and it was OK. Also tried "compact on close"
 
hi mike

Nearly finished a registry block. When it's finished, are you interested? It's working quite well. It checks for the key, if it's not there, all good and brand new. If it is there, get the value.

Nigel
 
hi mike,

Will get this done today promise. Have to do parent things first. Sorry :(
 
Nigel,

Take your rime, just have a go at your own leisure.
 
Nigel,

Here is another approach I am trying which probably is similar in principle to The Doc Man's approach.

I have used Allen Browne's function for FileExists

Public Function MakeLetters()
If Len(Dir("c:\Windows\Letters", vbDirectory)) = 0 Then
MkDir "c:\Windows\Letters"

End If

If FileExists("C:\Windows\Letters\TableBU.mdb") = False Then

Dim ws As Workspace
Dim db As Database
Dim LFilename As String

Set ws = DBEngine.Workspaces(0)

LFilename = "c:\Windows\Letters\TableBU.mdb"

Set db = ws.CreateDatabase(LFilename, dbLangGeneral)

End If

End Function

That works OK and does not replace the file TableBU.mdb when run a second time.

Instead of calling the sub folder to \Letters I could give it one of those Windows looking type of names, with numbers and stuf:)

However, I have nt worked out where to go from here, that is the next stage:D

I suppose I could put an autoexec in the created data base with CopyObject to get the table across and a copy object going the other way with the updated table caused by Date() insert.
 
Nigel,

I put an Autoexec in the db that is created in the sub folder for Windows'

SetWarnings No
CopyObject
Quit

Opened it from the main DB with

Call Shell("C:\Program Files\Microsoft Office\Office11\MSAccess.exe C:\Windows\Letters\TableBU.mdb")

So if even they fild the table USysSystem and alter the record or delete it there is no problem.

So again, the basis is that the value in the table field is setvalued to Date() IF it is <= to Date() so that prevents wind back of the computer date. In other words, the date in that field can never be less than the last entry.

But what would defeat it is if the person always wound back the date of the computer every time they used the program so that the date in the field was never allowed to advance.

The only way I can think of to get around that (and perhaps this is a registry issue) is to have that date in the table updated by some other activity on their computer.
 
Nigel,

I have the mechanics of that all working. I also included at the end of the code run

Name "C:\Windows\Letters\TableBU.mdb" As "C:\Windows\Letters\TableBU"

And it comes the other way on AutoExec

Name "C:\Windows\Letters\TableBU" As "C:\Windows\Letters\TableBU.mdb"

So doing a search on .mdb won't find it and in addition I would gibe som ename that looked like a windows file. In fact it is probably best not to make a sub folder of Windows but just install the file directly in \Windows.

Without resorting to regisrty ( if that would do the job) the only way I can think of at the moment to cater for them winding back the computer date every time they use the program so as to stop the data advancing would be to have a text box that is

Date()-LastDate with LastDate being the date that is stored from Date(). If that gives a negative annswer then it stops the program and a message along the lines of

The date on your computer appears to have changed its sequence:D etc. please contact

They would only need the stored date to advance one day and a wind back would be picked up if they wound back past that date. Not a 100% but probably close to it.

As a side note, this business of changing the computer date can wear thin real fast. I having been doing a lot with testing this stuff and you forget you have done. One thing fouls up is forums such as this.
 
Nigel

I had an autoexec open the DB buried in Windows and that DB had autoexec with CopyObject followed by Quite. The autoexec on the main DB then opened a form which is based on the hidden table, the one copied across with copyobject. However, sometimes the msg would pop up..can't find table etc... If removed the OpenForm from the autoexec and waited a few second and then opened the form all was OK. Seems to be a delay with CopyObject

So I changed things. The autoexec on the main DB now deletes the table and then does import and then opens the form. That seems to be fine.

CopyObject back to the DB buried in Windows is no problem as that DB is not used as such, just a hidden storage spot.
 
hi mike
how are you progressing on this ?

rob
 
Rob,

I have it working and made a fucntion to create and install the hidden DB in \Windows plus two tables that go in it and the autoexec. That will run when the person installs it.

When the code runs that does the job it then changes the name of the hidden DB so the .mdb extension is removed. So doing a saerch on mdb won't find it. When the main DB is started in renames it back to a .mdb and then renames without the DB.

There are two tables in the hidden DB one of which is the same name as the hidden table in the main DB and when the main DB starts it opens the hidden DB which has an autoexec that takes the table with the highest date value and changes the one with the lower value to the higher value. When the code runs it deletes the table of the same name in the main DB and imports from the hidden DB

The only thing I have been able to do to defeat it is to keep changing the computer date back so it never advances. In other words if the finish date was 15/1/09 and the person changed the eir computer to 10/1/09 each time the program was run then date would not advance. But I can't see someone doing that every time they run it.

The finsihing date is stored on the OnClick line of a textbox and as the result of Finish Date X 86400. So if the finish date was 15/1/09 then I put 3441139200 on the OnClick line a if it was a macro. A formula in a text box reads it as in

=((Forms!Form1!Text2.OnClick)-([xyz]*86400))/86400

[xyz] is setvalued to Date() but only if [xyz]<=Date(), thus winding back the computer can't give an early date.

I am cleaning it up in the next day or so and I will attach.
 
Hi Mike

Thought you might find the attached database interesting.

It is a striped out version of how i package my demo databases.
It stores the values in the database properties (nice and tidy no external files or tables that can be tamperd with)

(my full version has the function to set days of trial, times opened also register using an algorithm and the registry)
This one has only the function to set number of trial days.

If you set the date back it wont run (gives a message to the user)
when it reaches the date to expire it stops running (also gives a message to user)
I have tested this and cant find and way to defeat it but you never know someone might.:o
but for average user it fairly secure to distribute:)
 
Last edited:
Thanks for that Rob, I will have a look tomorrow as 3.20 am down here and I might go to bed.:)

On mine I could bring up a message if they wind the computer date back to an earlier date than the last done. I just need Date()-[xyz] and if it is negative I was going to put a "stop" and a message along the lines of....there appears to be a problem with the date sequence of your computer....:D
 
Just had a a quick look,plenty to look at there. I had to import them to open them:)
 
Rob,

I just realised testing yours that Now() needs to be the reference for computer wind back, same deal in what I made as by picking up the time it means the person can't really hold it on the same date.
 
thought you were going to sleep lolll :)

glad i could help :D
 

Users who are viewing this thread

Back
Top Bottom