combo box

krishnanhemanth

Registered User.
Local time
Today, 08:53
Joined
Jun 12, 2009
Messages
115
hi all

my database is split and the front end is running on 4 comps with the back end on a separate server.
the user security is in place and is working fine.
i have a master switchboard that contains an unbound combobox called "modules"

This unbound combo box shows a list of available forms.
what i want is ...
filter the unbound combobox withrespect to the user that is logged in to the database.

for example....if the user is accounts... then only those forms that are related to accounts need to be displayed in the combo box..

please help
hemanth
 
If your users can be placed into groups or users, then give eaxh user a group id and give each form a group id and base your filter on that. No you will be saying what happens if two or more groups can open the same form. Lets say you have 4 groups A, B, C, D & E. For each form you have a potiential code of ABCDE

User Fred belongs to Group C he can open any form that has a C in the form code.

Form1 Code = ABCDE - Opened by anyone
Form2 Code = ABDE - Cannot be opened by user Group C
Form3 Code = C - Can only be opened by group C users


So when user Fred logs you can easily test if they can open a particular form

Code:
If CanUserOpenForm(FormName, UserGroup) = True Then
  DoCmd.OpenForm .....
End If

Code:
Public Function CanUserOpenForm(AnyFormName As String, AnyUserGroup As String) As Boolean

'/Get the name of the form and the user group letter
'/Test to see if thi user can open the form


Dim FormCodes As String
    FormCodes = DLookup("Letters","FormsTable","FormName='" & AnyFormName & "'")

If InStr(FormCodes ,UserGroup) > 0 Then
   CanUserOpenForm = True
Else
   CanUserOpenForm = False
End If

End Function
 

Users who are viewing this thread

Back
Top Bottom