UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Lock Edits By Vba For Specified Network-ids, Access 2016    
 
   
techexpressinc
post Apr 8 2020, 10:46 AM
Post#1



Posts: 486
Joined: 6-October 08
From: indiana, usa


We need only one set of users to be able to update the values.

Can VBA change the Form Property Sheet values based on user. I do have the Network-id-s.
On Open form we Property Sheet values:
Allow Additions
Allow Deletions
Allow Edits
to change to "No".
Any ideas on the VBA code needed?

Thanks Russ
Attached File(s)
Attached File  PROPERTIES_2020.jpg ( 99.55K )Number of downloads: 6
 

--------------------
Thanks,
Russ Neuman, Insurance designations = FLMI, ASC, ALMI
Certified MS-Office Specialist
Go to the top of the page
 
theDBguy
post Apr 8 2020, 11:10 AM
Post#2


UA Moderator
Posts: 78,098
Joined: 19-June 07
From: SunnySandyEggo


Hi. Those are all available as:

Me.AllowAdditions
Me.AllowEdits
etc.

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 
isladogs
post Apr 9 2020, 04:34 AM
Post#3


UtterAccess VIP
Posts: 2,311
Joined: 4-June 18
From: Somerset, UK


Suggest you add a UserLevel field to your users table and assign levels e.g. Level 1 for read only access, level 2 for full editing.
Assuming you've already saved the user ID as e.g. StrUserID, next create a function in a standard module to grab the user level
CODE
Function GetUserLevel()
GetUserLevel = DLookup("UserLevel", "tblUsers","UserID= '" & strUserID & ":’")[
End Function


Then in your form load event(s) add code similar to

CODE
Private Sub Form_Load
Select Case GetUserLevel

Case 1
Me.AllowEdits=False
Me.AllowAdditions=False


Case 2
Me.AllowAdditions=True
Me.AllowEdits=True

End Select
End Sub


Adapt as appropriate. If you have a lot of forms to manage, the code could be streamlined further

--------------------
Colin (Mendip Data Systems)
Website, email
Go to the top of the page
 
techexpressinc
post Apr 9 2020, 07:32 AM
Post#4



Posts: 486
Joined: 6-October 08
From: indiana, usa


Thanks

I will try the methods out an let you know how they work.

Russ



--------------------
Thanks,
Russ Neuman, Insurance designations = FLMI, ASC, ALMI
Certified MS-Office Specialist
Go to the top of the page
 
techexpressinc
post Apr 27 2020, 06:40 AM
Post#5



Posts: 486
Joined: 6-October 08
From: indiana, usa


All is working.
A question what is the best event to lock the fields?
Russ

--------------------
Thanks,
Russ Neuman, Insurance designations = FLMI, ASC, ALMI
Certified MS-Office Specialist
Go to the top of the page
 
isladogs
post Apr 27 2020, 09:00 AM
Post#6


UtterAccess VIP
Posts: 2,311
Joined: 4-June 18
From: Somerset, UK


If using code like that in post #3, use Form_Load as stated in that code.

--------------------
Colin (Mendip Data Systems)
Website, email
Go to the top of the page
 
techexpressinc
post Apr 27 2020, 11:51 AM
Post#7



Posts: 486
Joined: 6-October 08
From: indiana, usa


Thanks

--------------------
Thanks,
Russ Neuman, Insurance designations = FLMI, ASC, ALMI
Certified MS-Office Specialist
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    27th May 2020 - 07:46 AM