Sir,
Thanks for your reply.
I read your site and have learned earlier also and again I read for this topic. Nice and useful contents and example code.
My BackEnd is still in Access 2000. I work for front end on Access 2000 and windows XP. As some of the user are still in that version. Once front end is finalized, then I convert in mde and Access 2007 - accde and copy to the each user PC according to their
version of office and refresh their link with data. And it is working fine.
That is the reason, I selected Office 2003 and Windows XP for question posting according the Master working PC.
Situation as explained in the above post.
Currently I am handling as below.
Table Name : USysTblLevel
| ULevel |
UserName |
UserLocation |
UserBranch |
UserRemarks |
UserValidDate |
| 1 |
Irshad.Alam |
DXB |
MUSF |
FULL ACCESS |
27/08/2018 |
On Form open event it checks :
Private Sub Form_Open(Cancel As Integer)
On Error Resume Next
If DLookup("[ULevel]", "[USysTblLevel]") > 2 Then
Me.AllowAdditions = False
Me.AllowDeletions = False
DoCmd.RunCommand acCmdRecordsGoToLast
Else
Me.AllowAdditions = True
DoCmd.RunCommand acCmdRecordsGoToNew
Me.AllowDeletions = True
End If
End Sub
But the problem arises when an User goes on leave and other user of other department have to take care of his particular job - example MachineReceiving Entry , at that situation user level does not matches and he is unable to do the data entry. Or If I change
his level to 1 then he will have access to other form which should not be.
What I was trying to gather an idea, like, to have another table Name "TblFormSecurity" having a fields : FormName, EditAllowedTo
Then to create record with all the Forms name, and User level which can edit, by putting level in commas
| RecNo |
FormName |
AllowedUser |
| 1 |
MachineHistory |
1,2 |
so if the user Is required to increase of that form, then just add with comma. Like 1,3,9 only for edit/Add
Question arises, how to check this via vba at the time of opening the form.
Was thinking of some solution of taking -
a) not to disturb existing developed
b)Add a table mentioned above and with the help of below logic check the user level:
Dim arr() As String
arr = Split(DlookUp("[AllowedUser]","[TblFormSecurity]",",", Where FormName = Me.formName)
n = UBound(arr)
If DLookup("[ULevel]", "[USysTblLevel]") is available in arr() then
allow edit
else
No edit
Could not understand how to proceed further.
Please advice is it possible to develop the above method?.
It can be alternative approach to achieve the requirement?.
Regards