View Single Post
  #5  
Old May 25th, 2010, 08:17 PM posted to microsoft.public.access.forms
Douglas J. Steele[_3_]
external usenet poster
 
Posts: 3,143
Default Freeze fields with a command button click

One approach would be simply to call the form's Current event in the
button's Click event:

Private Sub MyButton_Click()

Call Form_Current()

End Sub

--
Doug Steele, Microsoft Access MVP
http://www.AccessMVP.com/DJSteele
(no e-mails, please!)

"PJ" wrote in message
...

Thanks again Daryl. I guess I am not getting this. Would this go on the
form's current event. I wanted a button that I would click on that at any
given time I can click on and it would lock 6 fields and you could only
read
them. Where would they below code go?

Thanks!!
"Daryl S" wrote:

PJ -

Use the On Current event so this occurs each time a new record is
displayed
(use your fieldnames):

If Me.DateField DateSerial(Year(Date()),Month(Date(),1) Then
Me.Field1.Locked = True
Me.Field2.Locked = True
...
Me.Fieldn.Locked = True
Else
Me.Field1.Locked = False
Me.Field2.Locked = False
...
Me.Fieldn.Locked = False
End If

--
Daryl S


"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