Read only after record save

migrif

Registered User.
Local time
Today, 14:33
Joined
Jul 14, 2008
Messages
15
I am looking for a way to lock an entire record down after a save has been executed. This may seem strange, but my form is 6 fields, and records do not/should not need to be updated once entered (via the form). Having said that, I am looking at locking at the form level, but having access at the table level to make changes if needed.
 
You can use the Current Event of the form to lock the form unless Me.NewRecord is true.
 
Rural guy, so that I am clear, you are referring to the "On Current" event, correct? I still am fuzzy on the last piece of code you are referring to. As of now, there is no event associated with the On Current.
Thanks
MG
 
Every time you go to a different record you will get an OnCurrent event. If you check the form's NewRecord property which is only true if you are on a NewRecord then you can lock all of the controls on the form if you are not on a new record.
 
Last edited:
Here's what Allan's talking about, replacing the field names with the actual names of your six fields:

Code:
Private Sub Form_Current()
If Me.NewRecord Then
  Field1.Locked = False
  Field2.Locked = False
  Field3.Locked = False
Else
  Field1.Locked = True
  Field2.Locked = True
  Field3.Locked = True
End If
End Sub
 
you can also use two command buttons edit and save

Onclick event of save button paste following code
[forms]![form1].allowedits=false

Onclick event of edit button paste following code
[forms]![form1].allowedits=true
 

Users who are viewing this thread

Back
Top Bottom