Solved

Splash form for registration status using KeyedAccess

Posted on 2004-03-29
8
292 Views
Last Modified: 2008-02-01
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".
0
Comment
Question by:jaimexctsg
  • 5
  • 3
8 Comments
 
LVL 77

Expert Comment

by:peter57r
Comment Utility
Hello jaimexctsg,

By definition, a Global Constant is just that - constant.  You set its value in it's declaration. So once you set it so that the application closes, I'm wondering where you go from there?  You cannot assign a value to a constant programmatically.

Also, a module does not have an outcome.  A function procedure can return a value but a module is just a container for procedures.  So whatever outcome you need to test it must come from a function.  basKeyedAccess sounds like a module name to me, so you first need to identify which function is returning a value.

Pete
0
 

Author Comment

by:jaimexctsg
Comment Utility
Thanks for your explanation. I am new to VBA, don't know VB either. My training was in ORACLE SQL, and that was 10 years ago. So I am lost. I looked it up, thanks to you, and 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."
Please be as specific as possible, like I said, I'm in new waters here.
Jaime
0
 

Author Comment

by:jaimexctsg
Comment Utility
How can I set a Variable so that all forms can "decide" how to behave, depending on the results of this function, which only runs once at rthe begining of the program.
0
 
LVL 77

Accepted Solution

by:
peter57r earned 500 total points
Comment Utility
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
0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 

Author Comment

by:jaimexctsg
Comment Utility
Thanks, i have not had time to try it but was able to uunderstand the "How To".
0
 
LVL 77

Expert Comment

by:peter57r
Comment Utility
Ok.
If you run into problems post back and I'll be happy to help.

Pete
0
 

Author Comment

by:jaimexctsg
Comment Utility
My mistake, it seems to me the function returns boolean (0, -1).
For the time being  it willk be better to use only one serial verification.
The correct test string for the verification is:

'*  in the "Open" event procedure the splash form has
 
If ka_ValidateKeyWithPrompt(True) Then
    ‘* The program is registered.
    '*The splash form opens normally
Else
    MsgBox "This program is not registered."

    '* I don't know how to put a global variable here to indicate
    '* that the application is in shareware/demo mode
    '* and to be used in the other forms open event
    '* Tried to use varVerif (which I declared on a module by writting; "Public varVerif As Variant"
    '* Without the quotation marks), but could not access it from the other forms.
End If

What am I doing wrong?

0
 

Author Comment

by:jaimexctsg
Comment Utility
I gotr it. varVerif works! Must have had a typo! Thanks for your guidance Pete, I didn't know where to start!
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Join & Write a Comment

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now