Solved

Splash form for registration status using KeyedAccess

Posted on 2004-03-29
8
326 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
ID: 10706900
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
ID: 10738469
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
ID: 10738502
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 77

Accepted Solution

by:
peter57r earned 500 total points
ID: 10739048
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
 

Author Comment

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

Expert Comment

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

Pete
0
 

Author Comment

by:jaimexctsg
ID: 10745965
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
ID: 10746006
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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

713 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