How do I create a Global Variable to do this... (1 Viewer)

Steve C

Registered User.
Local time
Today, 12:31
Joined
Jun 4, 2012
Messages
120
The AutoExec Macro runs some third party code* and opens Form1 which prompts for a valid Registration number (used by the third party code).

If a user bypasses the AutoExec macro and opens the Database window**, they avoid Registration and can open any Form they like - effectively - use the application normally.

So, I imagine (now I’m guessing here gentlemen) some vba in, say, the OnClose Event of Form1 to change something (a Global variable perhaps??) to True. Then, All other Forms check that Global Variable for “True” in their OnLoad Event.

That way, although the user would see the names of my Forms in db1.mde database Window but, he’ll not be able to open any of them except Form1 – and Registration.

Any help would be much apreciated

*Third party Registration Module is Keyed Access from www.PetersSoftware.com

** according to: http://www.techrepublic.com/blog/10things/10-tips-for-securing-a-microsoft-access-database/552
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 20:31
Joined
Sep 12, 2006
Messages
15,692
are there no instructions with the supplied software?

one obvious way is to use your autoexec procedure to set a public flag (boolean) that registration is checked - - and test that in each forms open event.

you wouldn't want to enter the registration key every login, would you?
 

bob fitz

AWF VIP
Local time
Today, 20:31
Joined
May 23, 2011
Messages
4,726
Steve C

Perhaps the attached db will give you some ideas.
 

Attachments

  • AutoExec.mdb
    124 KB · Views: 87

Steve C

Registered User.
Local time
Today, 12:31
Joined
Jun 4, 2012
Messages
120
WOW! I’ve got goose bumps, Bob Fitz!! THANK YOU!!! I could not have done this on my own, it’s brilliant and perfect. I spent all afternoon on this problem and all I got was a headache – I’m so grateful. Thank you again.

Here’s what I did for anyone following;

Opening Bob Fitz’s db with the Shift key Down means the AutoExec doesn’t run and sure enough, Text1 on frmStartUp reads False

I put this vba in Form2 OnLoad Event

Private Sub Form_Load()
If fnAutoExecRan = False Then '***the AutoExec was bypassed
MsgBox "You Didn't say the magic word."
DoCmd.Close
Else
'***Nothing - the Form2 just opens
End If
End Sub

Hi GTH, to be fair to Peters Software – their instructions assume I know something about Access.
On the other hand, if I did know something about Access, I wouldn’t have bought Peters’ software.
 
Last edited:

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 20:31
Joined
Sep 12, 2006
Messages
15,692
the comment about peters software is a bit unreasonable

if you distribute software, then you need a way to prevent unauthorised copying of your software. I don't know the details of peters system, but that's what it is trying to do.

maybe the point is that you don't really need this sort of functionality until you reach the stage where you have a distributable application. And then it's a matter of taste whether you design thre anti-copying mechanism yourself, or buy it in.
 

Steve C

Registered User.
Local time
Today, 12:31
Joined
Jun 4, 2012
Messages
120
Sorry Gemma-the-husky, you are right.

I didn't mean to offend Peters Software or suggest they'd done anything wrong. For clarity, Peters Software does exactly what they say it does.

Instead, I was aiming a joke (which wasn't funny) at my own naivety,

May I ask you to understand, it was past midnight when I wrote my last post, I didn't think it through.

You're right again when you say; "maybe... you don't really need this sort of functionality...".

So, I apologise if I was out of line. Thank you for your Post
 

Users who are viewing this thread

Top Bottom