J
John
Hello. I have the following code that I would like to put into a
function or a sub and I am not skilled in that area. Should be, but
never really had a reason. I've taken over this db and the prior dev
used functions and subs alot. I have 4 forms (opened by buttons) that
are getting restricted to employees only, no contractor access. The
following code works but is in the click event of one of the buttons.
I would prefer not to have this in 4 places incase a change is
needed. The line that starts with MyOpenForm was originally the only
line in the button click event. In all 4 cases, this line would
change.
Can someone take a look at this and see if a call to a function or sub
can be made out of this?
Thanks.
Dim user_allowed_so_access As Boolean
user_allowed_so_access = DLookup("Contractor", "Employees", "ID=" &
gUserID)
If user_allowed_so_access = True Then
MsgBox "You are not allowed access to the Sales Order
information.", vbOKOnly, "No Access"
Exit Sub
Else
MyOpenForm "SalesOrders", , , , acFormAdd
End If
function or a sub and I am not skilled in that area. Should be, but
never really had a reason. I've taken over this db and the prior dev
used functions and subs alot. I have 4 forms (opened by buttons) that
are getting restricted to employees only, no contractor access. The
following code works but is in the click event of one of the buttons.
I would prefer not to have this in 4 places incase a change is
needed. The line that starts with MyOpenForm was originally the only
line in the button click event. In all 4 cases, this line would
change.
Can someone take a look at this and see if a call to a function or sub
can be made out of this?
Thanks.
Dim user_allowed_so_access As Boolean
user_allowed_so_access = DLookup("Contractor", "Employees", "ID=" &
gUserID)
If user_allowed_so_access = True Then
MsgBox "You are not allowed access to the Sales Order
information.", vbOKOnly, "No Access"
Exit Sub
Else
MyOpenForm "SalesOrders", , , , acFormAdd
End If