?
Solved

Splash form for registration status using KeyedAccess

Posted on 2004-03-29
8
Medium Priority
?
336 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
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 
LVL 77

Accepted Solution

by:
peter57r earned 2000 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

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 …
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
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…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
Suggested Courses

800 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