VBA Code for using database as a trail version

S

StuJol

i have a database which im going to convert into a package using Visual
Studio Tools for the Microsoft Office System and distrubute to customers.
This is the first time ive done this and are unsure how it will work. i want
my program to have a trail period and then by putting in a product key, you
can have full access to the program.

Does anyone know if this is done in Visual Studio Tools for the Microsoft
Office System or will i have to write some code in Access for my database??
 
D

Douglas J. Steele

You'll have to write your own code, or purchase a 3rd party control that
will do most of the work for you.

You might try reposting this in
microsoft.public.access.developers.toolkitode or
microsoft.public.access.devtoolkits newsgroup: the people there are more
knowledgable as to what 3rd party controls there are.
 
S

StuJol

many thanks, i'll try that

Douglas J. Steele said:
You'll have to write your own code, or purchase a 3rd party control that
will do most of the work for you.

You might try reposting this in
microsoft.public.access.developers.toolkitode or
microsoft.public.access.devtoolkits newsgroup: the people there are more
knowledgable as to what 3rd party controls there are.
 
R

Rainbow01

You can try: http://www.peterssoftware.com/

if u want to do by yourself, you can write VBA by following step
1) use WindowsAPI to write information(e.g. StartDate, Password) into
Windows Registry when your application first time run
2) make a form for user to input your Product Key
3) check Product Key and StartDate with Windows Registry
4) if correct, user can use the application, if wrong, user cannot use it

"StuJol" 來函:
 
D

David C. Holley

You'll have to write your own code. If you can search back a few months
ago, as there were several posts here pertaining to the subject. If I
were implelemnting this I would approach it in this way...

-Create a table for system values with three columns
[txtSystemValue] - Action value (1.0, 10/31/2005, 2342-KIO4-DWEF)
(KEY)[txtSystemValueDescriptionShort] - (VERSION, RDATE, PRODUCTKEY)
[txtSystemValueType] (Number, Text, Texxt)
[txtSystemValueDescriptionLong] (Version Number, Release Date, Product Key)

The txtSystemValueDescriptionShort (ex HIDEOLDINVAGE) is provided to
allow for a short way of describing the value and is used for actually
retrieving the value.
txtSystemValueDescriptionLong (ex Hide invoices closed after X number of
days) is provided to allow a less kryptic description of the value to
make identification of it easier.

While you're creating the table for use with the product key, you may
find some other uses for it such as including Version number, who the
product is licensed to, etc. The columns are flexible enought to handle
any type of value using the following function (or one similar to it).
The function below lookups up the value and is data type and then
converts the value to the appropriate type. If the data type is TEXT,
the function returns the value from the DLookup(). I used CDbl() for the
number values to provide the greatest amount of flexibility when dealing
with numbers.

Function getSystemValue(strValue As String)

Dim tmpValue As Variant
Dim tmpValueDataType As Variant

tmpValue = DLookup("txtSystemValue", "tblSystemValues",
"txtSystemValueName = '" & strValue & "'")
tmpValueDataType = DLookup("txtValueType", "tblSystemValues",
"txtSystemValueName = '" & strValue & "'")

Select Case tmpValueDataType
Case "Number"
tmpValue = CDbl(tmpValue)'converts to a numeric value
Case "Date"
tmpValue = CDate(tmpValue)'converts to a date value
Case Else
End Select

getSystemValue = tmpValue

End Function

Then you just have to develop how to encode the expiration date into the
product key and the function to extract it. For that I would recommend
embedding the expiration date in to the key and using the 100 year date
for it. (The 100yr date is the number of days since 1/1/1900 appears as
a five digit number. The 100yr date for today is 38600.) To obtain the
100 yr date use the CLng() function on a date value as in CLng(Date()).
From there its a matter of figuring out where to imbed the value into
the product key. The simplist would be to breatk up the 100yr date and
place the values at specific locations in the product key such as

3xxx-8xxx-6xxx-0xxx-0xxx

Your users probably won't be adept enough to figure out that the first
digit of each segment combine for the expiration date. If you wanted to
go I layer deaper, you could convert the individual digits to represent
their alpha equivalent using A as 0 as in

Dxxx-Ixxx-Gxxx-Axxx-Axxx

You could even use a method where that randomly uses the number or alpha
scheme so that the same user gets a varying product key each time a new
one is sent them as in

3xxx-Ixxx-6xxx-Axxx-0xxx
Dxxx-8xxx-6xxx-Axxx-Axxx
Dxxx-Ixxx-Axxx-0xxx-Axxx

The code that extracts the expiration date would again look at the first
character of the segment, determine if is a letter or number, and
convert it to its numerical equivalent if a number.

BTW - the function to extract the date would be a function that uses the
Split() (ex: aTest = Split("Dxxx-Ixxx-Axxx-0xxx-Axxx","-"))function to
break up the segments and the get the values.

David H
 
D

David C. Holley

You'll have to write your own code. If you can search back a few months
ago, as there were several posts here pertaining to the subject. If I
were implelemnting this I would approach it in this way...

-Create a table for system values with three columns
[txtSystemValue] - Action value (1.0, 10/31/2005, 2342-KIO4-DWEF)
(KEY)[txtSystemValueDescriptionShort] - (VERSION, RDATE, PRODUCTKEY)
[txtSystemValueType] (Number, Text, Texxt)
[txtSystemValueDescriptionLong] (Version Number, Release Date, Product Key)

The txtSystemValueDescriptionShort (ex HIDEOLDINVAGE) is provided to
allow for a short way of describing the value and is used for actually
retrieving the value.
txtSystemValueDescriptionLong (ex Hide invoices closed after X number of
days) is provided to allow a less kryptic description of the value to
make identification of it easier.

While you're creating the table for use with the product key, you may
find some other uses for it such as including Version number, who the
product is licensed to, etc. The columns are flexible enought to handle
any type of value using the following function (or one similar to it).
The function below lookups up the value and is data type and then
converts the value to the appropriate type. If the data type is TEXT,
the function returns the value from the DLookup(). I used CDbl() for the
number values to provide the greatest amount of flexibility when dealing
with numbers.

Function getSystemValue(strValue As String)

Dim tmpValue As Variant
Dim tmpValueDataType As Variant

tmpValue = DLookup("txtSystemValue", "tblSystemValues",
"txtSystemValueName = '" & strValue & "'")
tmpValueDataType = DLookup("txtValueType", "tblSystemValues",
"txtSystemValueName = '" & strValue & "'")

Select Case tmpValueDataType
Case "Number"
tmpValue = CDbl(tmpValue)'converts to a numeric value
Case "Date"
tmpValue = CDate(tmpValue)'converts to a date value
Case Else
End Select

getSystemValue = tmpValue

End Function

Then you just have to develop how to encode the expiration date into the
product key and the function to extract it. For that I would recommend
embedding the expiration date in to the key and using the 100 year date
for it. (The 100yr date is the number of days since 1/1/1900 appears as
a five digit number. The 100yr date for today is 38600.) To obtain the
100 yr date use the CLng() function on a date value as in CLng(Date()).
From there its a matter of figuring out where to imbed the value into
the product key. The simplist would be to breatk up the 100yr date and
place the values at specific locations in the product key such as

3xxx-8xxx-6xxx-0xxx-0xxx

Your users probably won't be adept enough to figure out that the first
digit of each segment combine for the expiration date. If you wanted to
go I layer deaper, you could convert the individual digits to represent
their alpha equivalent using A as 0 as in

Dxxx-Ixxx-Gxxx-Axxx-Axxx

You could even use a method where that randomly uses the number or alpha
scheme so that the same user gets a varying product key each time a new
one is sent them as in

3xxx-Ixxx-6xxx-Axxx-0xxx
Dxxx-8xxx-6xxx-Axxx-Axxx
Dxxx-Ixxx-Axxx-0xxx-Axxx

The code that extracts the expiration date would again look at the first
character of the segment, determine if is a letter or number, and
convert it to its numerical equivalent if a number.

Of course you could event go 1 step further and alter the location of
the key value in each segment where the segment number indicates where
the value is. Using this the above keys become...

3xxx-xIxx-xx6x-xxxA-Xxx0
Dxxx-x8xx-xx6x-xxxA-xxxA
Dxxx-xIxx-xxAx-xxx0-xxxA

(The x's of course are just random numbers/letters.)

BTW - the function to extract the date would be a function that uses the
Split() (ex: aTest = Split("Dxxx-Ixxx-Axxx-0xxx-Axxx","-"))function to
break up the segments and the get the values.

David H
 
D

David C. Holley

You'll probably want to build a function in a separate DB that creates
the key for you.
You'll have to write your own code. If you can search back a few months
ago, as there were several posts here pertaining to the subject. If I
were implelemnting this I would approach it in this way...

-Create a table for system values with three columns
[txtSystemValue] - Action value (1.0, 10/31/2005, 2342-KIO4-DWEF)
(KEY)[txtSystemValueDescriptionShort] - (VERSION, RDATE, PRODUCTKEY)
[txtSystemValueType] (Number, Text, Texxt)
[txtSystemValueDescriptionLong] (Version Number, Release Date, Product Key)

The txtSystemValueDescriptionShort (ex HIDEOLDINVAGE) is provided to
allow for a short way of describing the value and is used for actually
retrieving the value.
txtSystemValueDescriptionLong (ex Hide invoices closed after X number of
days) is provided to allow a less kryptic description of the value to
make identification of it easier.

While you're creating the table for use with the product key, you may
find some other uses for it such as including Version number, who the
product is licensed to, etc. The columns are flexible enought to handle
any type of value using the following function (or one similar to it).
The function below lookups up the value and is data type and then
converts the value to the appropriate type. If the data type is TEXT,
the function returns the value from the DLookup(). I used CDbl() for the
number values to provide the greatest amount of flexibility when dealing
with numbers.

Function getSystemValue(strValue As String)

Dim tmpValue As Variant
Dim tmpValueDataType As Variant

tmpValue = DLookup("txtSystemValue", "tblSystemValues",
"txtSystemValueName = '" & strValue & "'")
tmpValueDataType = DLookup("txtValueType", "tblSystemValues",
"txtSystemValueName = '" & strValue & "'")

Select Case tmpValueDataType
Case "Number"
tmpValue = CDbl(tmpValue)'converts to a numeric value
Case "Date"
tmpValue = CDate(tmpValue)'converts to a date value
Case Else
End Select

getSystemValue = tmpValue

End Function

Then you just have to develop how to encode the expiration date into the
product key and the function to extract it. For that I would recommend
embedding the expiration date in to the key and using the 100 year date
for it. (The 100yr date is the number of days since 1/1/1900 appears as
a five digit number. The 100yr date for today is 38600.) To obtain the
100 yr date use the CLng() function on a date value as in CLng(Date()).
From there its a matter of figuring out where to imbed the value into
the product key. The simplist would be to breatk up the 100yr date and
place the values at specific locations in the product key such as

3xxx-8xxx-6xxx-0xxx-0xxx

Your users probably won't be adept enough to figure out that the first
digit of each segment combine for the expiration date. If you wanted to
go I layer deaper, you could convert the individual digits to represent
their alpha equivalent using A as 0 as in

Dxxx-Ixxx-Gxxx-Axxx-Axxx

You could even use a method where that randomly uses the number or alpha
scheme so that the same user gets a varying product key each time a new
one is sent them as in

3xxx-Ixxx-6xxx-Axxx-0xxx
Dxxx-8xxx-6xxx-Axxx-Axxx
Dxxx-Ixxx-Axxx-0xxx-Axxx

The code that extracts the expiration date would again look at the first
character of the segment, determine if is a letter or number, and
convert it to its numerical equivalent if a number.

Of course you could event go 1 step further and alter the location of
the key value in each segment where the segment number indicates where
the value is. Using this the above keys become...

3xxx-xIxx-xx6x-xxxA-Xxx0
Dxxx-x8xx-xx6x-xxxA-xxxA
Dxxx-xIxx-xxAx-xxx0-xxxA

(The x's of course are just random numbers/letters.)

BTW - the function to extract the date would be a function that uses the
Split() (ex: aTest = Split("Dxxx-Ixxx-Axxx-0xxx-Axxx","-"))function to
break up the segments and the get the values.

David H
i have a database which im going to convert into a package using
Visual Studio Tools for the Microsoft Office System and distrubute to
customers. This is the first time ive done this and are unsure how it
will work. i want my program to have a trail period and then by
putting in a product key, you can have full access to the program.
Does anyone know if this is done in Visual Studio Tools for the
Microsoft Office System or will i have to write some code in Access
for my database??
 
Top