Solved

Splash form for registration status using KeyedAccess

Posted on 2004-03-29
8
303 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
 
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
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 

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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

920 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

17 Experts available now in Live!

Get 1:1 Help Now