Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I Manage Form Modes

Status
Not open for further replies.

MissyEd

IS-IT--Management
Feb 14, 2000
303
GB
Hi all,

I am writing an application that uses each form in various modes. For example, to both display, edit and add a customer address.

I have roughly 15 forms in my app, but Im finding it difficult to manage the various modes and am looking for a tool that will allow me to specify the modes, the state of the controls on the form etc more efficiently.

At the moment, I have to go into each form and edit the case statement, but I can see this becoming a major pain.

As some of the modes depend on the user having permission to use them, I thought something that would allow me to create entries and then give perms to certain users would be useful.

A good example is the customer address form. Some users will only be able to view the form, while others can add new addresses or edit current addresses. There are also some restricted information about the address which only supervisors can edit - mainly grid information. Also depending on what mode the application is opened in, this form should only display certain groups of customers e.g Insurance Co.'s for one team and Solicitors for another.

Any ideas v.welcome.

cheers

Missy Missy Ed - Bolton, UK
 
One method that you may want to try is to establish a global variable (UserSecurityLevel) which contains the security level of the user.

Then perhaps in the form_load event, you can set the enabled property with the following line:

edText.Enabled = (UserSecurityLevel >= RequiredSecLevel)

This assumes that security levels are numeric.


Good Luck
------------
Select * from Users where Clue > 0
0 rows returned
 
I have used the form.tag property to identify what mode a form is in. You could set that tag based on the global suggested above, and enable/disable form features based on the tag setting.
 
Right: as regards disabling/enabling controls, look at:
This article shows how a COM+ application can disable or enable controls at run time. It interrogates the COM+ catalog to find out what roles a user belongs to but it is easy to adapt this framework to interrogate a roles table in a relational database (I know: I've done it).

Secondly, if you want to restrict visibility of data according to who the user is, then this is easy or hard, depending upon what RDBMS you use. We use Oracle 8i where I work and this supports a feature called 'fine-grained security', which does exactly this. If you have a client/sever RDBMS you can embed logic in stored procedures which return recordsets whose content varys according to what role the user is in. If you have some latitude in choosing your RDBMS platform, the go client server if possible. If you are using Access you could use the MSDE engine which would allow you to write stored procedures.
 
Quick and dirty solution, define 3 user passwords and depending on which one is used on entry make various components on the visible/enabled or not. a global would hold the status of the user, so all you have to do is decode the password and assign the status global value accordingly
luck!
 
Thanks for all the excellent suggestions. I like the idea of the tag property and the com+ suggestions. I'm investigating these as we speak.

Cheers again ! Missy Ed - Bolton, UK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top