how to restrict field updates

  • Thread starter Thread starter Rover
  • Start date Start date
R

Rover

I have a form that has a query as record source using 3 tables. That
form has a subform on it using a fourth table (call it tableX). I want
to restrict the user from modifying anything on the main form and only
be allowed to modify (add records to) tableX. How?

TIA
Jim
 
If you set Allow Edits on the main form to No, you lock the subform as well.
What you can do is lock the controls on the main form, except for subform
controls and buttons.

Example:
Private Sub Form_Load()
Dim ctl As Control
'In case this property isn't available on all controls
'just continue if there is an error
On Error Resume Next
For Each ctl In Me
If ctl.ControlType <> acCommandButton And ctl.ControlType <> acSubform
Then
ctl.Locked = True
End If
Next
'reset error handling here
End Sub
 
Back
Top