Reputation: 187
I´ve four tables.
If I assign a user to a service (saved in UsedServices), I want to check with a trigger if the user have the permission (lookup in table permission if user exists) to use the service.
In SQL it´s easy to write a trigger for that, but I don´t have any clue how to realize that in MS Access.
UsedServices fields: ID | SERVICE
Permission fields: ID | SERVICE | FROM | UNTIL
If a person add a record in table 'UsedServices', then i want to check if the id is in table 'Permission' ans if the Permission is still valid from now.
Upvotes: 0
Views: 2182
Reputation: 55981
To check if USER B have the permission in the 'Permission' table, use the BeforeUpdate event of the form:
Private Sub Form_BeforeUpdate(Cancel As Integer)
Cancel = YourPermissionDeniedCheckFunction(Me!UserID.Value)
If Cancel = True Then
MsgBox "User " & Me!UserName.Value & " has not been granted the required permissions for this task."
End If
End Sub
Upvotes: 1