1

Is it possible to lock specific columns from editing in an Access form ?

The problem is that I have a linked table in a form that shows information and users can update it. Now it turned out that there are some columns that need to be displayed to make the right decision, but I don't want them to edit these columns.

VBalazs
  • 67
  • 11

3 Answers3

1

Probably the easiest way to do this is to create a subform for your linked table, and embed that subform in datasheet view in your main form. Taking this approach, you can then lock the desired columns in design view on the subform, but it will still look and feel like a linked table in your main form.

AdamsTips
  • 1,648
  • 17
  • 22
0

What you can do is go to the the properties pane of the object. Then go to the data tab. You will find a value that says enabled and locked.

Set enabled to NO

and locked to YES.

Not sure if this is what your after or if you need something a little more secure, but this is where I would start

Daniel L. VanDenBosch
  • 2,350
  • 4
  • 35
  • 60
  • But this way I can only set this on the form, not on specific columns. Do you know how to do the same for columns ? – VBalazs Jul 16 '18 at 13:20
  • Not really. If you have security concerns I would look at pulling in all the data you need to the form via ado. Not sure how much time you have to work on your project, but if the solution must be access based and secure, you can do this by pulling in the data ado side. The following youtube series explains this to a tee. https://www.youtube.com/watch?v=HgdSCMMh4ig you can then compile to .accde and then nothing will get able. An easier less secure solution is when done developing the access app, change the file extension to .accdr . that will force the app to open in runtime. – Daniel L. VanDenBosch Jul 16 '18 at 21:00
0

Use Form_BeforeUpdate event on your form.

Private Sub Form_BeforeUpdate(Cancel As Integer)
    If Me.Field <> Me.Field.OldValue Then
       Cancel = True
    End If
End Sub

Me.Field is the column which user cannot change here. You can apply any logic/validation in this block.

Download Sample File - It has form frmEmployee which doesn't allow to change Employee name

Santosh
  • 12,175
  • 4
  • 41
  • 72