HOW TO: Declare Global Vars for Usernames

Ollie_3670

Registered User.
Local time
Today, 12:35
Joined
Feb 1, 2010
Messages
50
How exactly do you declare these in VBA? Currently I have a log on page which I want to include 2 user access levels.

At the moment you can type in "administrator" and the password admin or "tutor" with the password "tutor" and currently, it takes you to the same page with the same privs.

What I want is to put a check on a button saying "If user = admin, then docmd.openform". However I don't know how to incorporate code using switchboards..so I can't implement that either!

Any Ideas?
 
Last edited:
Convert the switchboard to a form to gain the full power available in forms. Switchboards are just crippled forms that use a table to define the coding.
 
How exactly do you declare these in VBA? Currently I have a log on page which I want to include 2 user access levels.

At the moment you can type in "administrator" and the password admin or "tutor" with the password "tutor" and currently, it takes you to the same page with the same privs.

What I want is to put a check on a button saying "If user = admin, then docmd.openform". However I don't know how to incorporate code using switchboards..so I can't implement that either!

Any Ideas?

use the form that is getting open to hsndle this. IMHO, this is not really a function of the switch board.

If you want to secure a form then it should be handled at the form level. This way no matter how the form gets opened, it will be secured.

I would place your code in the form's On Load event.
 
Convert the switchboard to a form to gain the full power available in forms. Switchboards are just crippled forms that use a table to define the coding.

I have to totally disagree. I think it is just the opposite.
 
I have to totally disagree. I think it is just the opposite.

A Switchboard is a quick and dirty substitute for an intelligently constructed form. While I can accept some developers find them useful, the suggestion that it is "just the opposite" (a form being a crippled version of a Switchboard) cannot be sustained.

A Switchboard's Record Source is consumed by the button programming information. Consequently it is undeniably crippled for interaction with real data.

A form with ordinary buttons can do everything that can be achieved on a switchboard and still have a real record source allowing it to display data without the need for a subform or clumsy domain functions as control sources.
 
I dont understand this discussion, to be honest.

A switchboard is just another form. The issue is one of presentation, surely?

Given any form with a button on it - we have the question - who should be able to push this button -

so we have (at least) two solutions

in the code for the button click - test the user, and see if the user can do this OR
in the code for the form - determine whether the button should visible, or enabled for the given user

so this problem then becomes a different issue - how do you secure an application - in the OPs case, how do you prevent the user logging-in inappropriately - How do you secure the data - How do you prevent a knowledgeable user bypassing all your security precautions- - How do you prevent a user copying your database - How do you prevent a user reading your backend directly

note that you dont even need them to login - you can just test who they are based on their window's login - just set your supervisor/administrator permissions for certain users - and everyone else is a normal user. (but the same considerations about generally protecting the dbs still apply)
 
[snip]...who should be able to push this button -

so we have (at least) two solutions

in the code for the button click - test the user, and see if the user can do this OR
in the code for the form - determine whether the button should visible, or enabled for the given user...[/snip]

I may be adding fuel to the fire here but...how you add code to a switchboard? As the form it displays seems to be a template from which all other switchboards are based, which surely doesn't support individual button configuration, or does it?

I feel more inclined to go with a previous post and say to initiate the code in the on_load event of the form.

But going back to my original question, where do you declare a global variable in the VBA code? So I can store which user is logged in, when.

I'd very much like to do the Windows login feature, seems really clever..But I have strong doubts that my ability with access will stretch this far!


s how do you secure an application - in the OPs case, how do you prevent the user logging-in inappropriately - How do you secure the data - How do you prevent a knowledgeable user bypassing all your security precautions- - How do you prevent a user copying your database - How do you prevent a user reading your backend directly

This is the same issue as above in regards to skill gaps, the DB will reside on a secure virtual drive all university lecturers at a university can access. So any malicious attempts at the DB would have to first get through that and honestly, if they can breach the university servers, probably not too much I could do anyway if they wanted the information that bad!
 
the switchboard provided by access is just a form - the code is exposed, and modifiable. Its possible (but definitely not trivially possible) to examine every item that would normally be displayed on a menu, and determine whether you want to show the item to the particular user. This is no different to designing your own form, and putting some buttons on it to do different things - except that the MS switchboard has the inbuilt ability to show a hierarchy of menus. I like it.

in the same way, locking down a database to prevent unauthorised access, is also not trivial.
 

Users who are viewing this thread

Back
Top Bottom