Solved

Splash form for registration status using KeyedAccess

Posted on 2004-03-29
8
333 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 
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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

690 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