Activation Code (1 Viewer)

Vista2007

Registered User.
Local time
Today, 16:16
Joined
Feb 26, 2007
Messages
11
Is it possible to create an Activation Code process for a database? If it is can someone please point me in the correct direction. Any help with this would be greatly appreciated.

Just to be sure that I am making myself clear I hope. I want to create a runtime database that is launched from a CD but before it allows the user to install it an activation code must be put in.

Thank you in advance
 

llkhoutx

Registered User.
Local time
Today, 15:16
Joined
Feb 26, 2001
Messages
4,018
Are you using the Statup option for the database (Tools > Statup > Display Form/Page). That will cause the specified form or page to open when Access opens.
 

Vista2007

Registered User.
Local time
Today, 16:16
Joined
Feb 26, 2007
Messages
11
Maybe I am not saying this correctly. Hopefully this will explain what I am tring to do. If I went out and purchased Office 2007 in order for me to use it I will need an activation code. Is their a way to have that feature built into custom databases. If so can someone point me in the right direction.
Thanks
 

ByteMyzer

AWF VIP
Local time
Today, 13:16
Joined
May 3, 2004
Messages
1,409
No, you stated yourself quite clearly the first time. The following code should give you an idea:
Code:
' Function to retrieve the custom database property: ActivationKey
Public Function GetActivationKey() As String
    Dim db As Database, prp As Property
    Dim doc As Document

    Set db = CurrentDb
    Set doc = db.Containers!Databases.Documents!UserDefined
    On Error Resume Next
    Set prp = doc.Properties("ActivationKey")
    If Err.Number = 0 Then
       GetActivationKey = prp.Value
    End If
End Function

' Function to set the custom database property: ActivationKey
Public Sub SetActivationKey(ByVal keyValue As String)

    Dim db As Database
    Dim doc As Document
    Dim prp As Property

    Set db = CurrentDb
    Set doc = db.Containers!Databases.Documents!UserDefined
    Set prp = doc.CreateProperty()
    With prp
        .Name = "ActivationKey"
        .Type = dbText
        .Value = keyValue
    End With
    doc.Properties.Append prp

End Sub

Public Function StartupCode()

Dim sInput As String

' Validate Activation Key
If IsNull(GetActivationKey) = True Then
    Do While sInput <> [b]"123abc"[/b] ' Set your own Key Value here
        sInput = InputBox("Please enter the Activation Key")
        If Nz(sInput, "") = "" Then Application.Quit
    Loop
    SetActivationKey sInput
End If

' Remainder of Startup Code

End Function

This is just a rough idea. I'm sure you can refine it from here.
 

KeithG

AWF VIP
Local time
Today, 13:16
Joined
Mar 23, 2006
Messages
2,592
There is no true full proof way to do this. There are methods of simulating this feature but there are always way around them.
 

llkhoutx

Registered User.
Local time
Today, 15:16
Joined
Feb 26, 2001
Messages
4,018
You have to manually build such a feature. Database crackers will eat you alive.

Take a look at Garry Robinson's Real World Microsoft Access Datbase Protection and Security published by Apress, about $60. It's the best I've seen. Litwin, Getz, et al's Access 2000 (or 2002) Developer's Handbook, Enterprise Edition is also very good.

Robinson has a unique approach.

Database security requires considerable thought and code.
 

Vista2007

Registered User.
Local time
Today, 16:16
Joined
Feb 26, 2007
Messages
11
Is this all I need to get this to function.

Thanks in advance
 

Users who are viewing this thread

Top Bottom