URGENT Allow/Disallow editing in sub forms

R

Radar069

I have a form with sub forms which I need to restrict editing access.
I have managed to set the code for the main form, but I am having difficulty
with the sub forms.

Can anybody please give guidance.
 
D

Douglas J Steele

How are you doing it for the main form?

Wherever you're referring to Me there, use Me!NameOfSubformContainer.Form
 
R

Radar069

Doug,

Code on main for is:
Private Sub Form_Current()

If Me.blnEditable Then
Me.AllowEdits = True
Else
Me.AllowEdits = False
End If


End Sub
Have entered the field "blnEditable" on the form

Have atready tried this on sub form but does not work.
 
O

Ofer

You can lock or unlock the subform from the main form

Me.SubFormName.Locked = True
==============================
Or you can disable the editing

Me.SubFormName.Form.AllowEdits = False
Me.SubFormName.Form.AllowDeletions = False
 
O

Ofer

Did you look at my post how to lock the sub form from edit?
You can put it on the oncurrent event and on the after update event of the
field.
Better to put the code in one control and call this sub from the other
control, that way you need to maintain it in one place.
 
Top