Question : Splash form for registration status using KeyedAccess

Need specifics on creating a private sub for my splash form that will verify the status of a Global Constant and then; either close the whole aplliction, or proceed to open the switchboard. Also need to know how to assign a value to the Global constant depending on the results of a verification module "basKeyedAccess".

Answer : Splash form for registration status using KeyedAccess

found the function name is "ka_ValidateKeyWithPrompt" and returns an integer for an error or an integer that represents three levels of validation. I am not sure what they are but it would be safe to use a return value of 1,2, or 3, for the example.
 My question is: What would be the code to open a form "Form_Customers" if...

Case function returns 1: The program should open and work with all it's features. Eg. all controls enabled.

Case function returns 2: Program works with some features disabled, "Form_Customers" cannot be printed, and the new customer records cannot be saved to the underlying table.

Case function returns 3: Program closes after a brief MsgBox "The trial period has expired, please register your program."
------------------------------------------------------------------------------------------------------------------------------------
I assume you have a VBA module which holds your global objects.
In there you should add a public variable such as:

Public pubStatus  ' will hold the result of the function

In the Form Open Event of the splash form you need code such as:

pubStatus = ka_ValidateKeyWithPrompt()  ' returns value from function and sets global variable

if pubStatus = 3 then
MsgBox "The trial period has expired, please register your program.",,"Trial Period"
application.quit
end if

There is no general setting you can use to disable saves of new records or to disable printing.

In the Before Update event procedure for every form there must be something like:

if pubStatus = 2 and me.newrecord = true then
MsgBox "Record cannot be saved. Entries will be lost"
cancel = true
me.undo
end if

Disabling Print functions depends on what menus you have provided for the user.
You need to remove the print options from all user menus and assign a different action to Ctrl+P using an Autokeys macro.

Pete
Random Solutions  
 
programming4us programming4us