View Single Post
  #2  
Old May 25th, 2010, 05:52 PM posted to microsoft.public.access.forms
PieterLinden via AccessMonster.com
external usenet poster
 
Posts: 307
Default Freeze fields with a command button click

PJ wrote:
How would I lock multiple fields so a user can not change based on a click of
a button. There is a date field so once it hit month end I would like to
freeze a user from changing the record. How is that possible?

Thanks


Note that you cannot lock anything at table level. If the user has access to
update/delete queries that modify data, this won't work.

Sub cmdLockControls_Click()
With Me.Controls("ControlToLock")
.Enabled = False
.Locked = True
End with
End sub

You would have to have a boolean field in your table containing the status of
the record. Something like IsLocked... then in the OnCurrent event of the
form,

With Me.Controls("ControlToLock")
.Enabled = Not me!IsLocked
.Locked = Me!IsLocked
End with

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/201005/1