Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Locking record 1

Status
Not open for further replies.

Oromia

Programmer
Feb 6, 2006
12
0
0
US
I need to edit some fields in a record, and when done with editing make the record read only (lock the record). The rercord is edited via access form (front end). What is the simplest way to lock the record?
Your help is apprciated. Thanks
 
Why not try using the afterupdate event of the field you want to edit:

Private Sub FieldName_AfterUpdate()

Me.FieldName.Locked = True

End Sub
 
Hard to say what is the easiest, depends on your buisness rules and how the user interacts with the form interface. Maybe you have your form that you set "Allow Deletions, Allow Additions, and Allow Edits" to false. The user can see all the data and scroll through records. To edit, delete, or add a record you click on a button and a pop up form with only the editable fields for that record are on it.
 
I tiried SSATECK's sugestion and it locks the given field but it locks the entire reocrd in the table. I might have not stated the question clearly but what I wanted is to lock a particular record not a particular field.
Thank you.
 
A solution could be to create a field called "locked" in your table. Have it on your form but be invisible.

Create your form to not allow edits.

Have a button called "edit mode". When pressed, it checks to see if the field locked is yes or no. If no, it gives a message saying the record can no longer be edited. If yes, it changes the form to allow edits. (probably this should disable any navigation buttons, as well.)

After someone edits the record, part of the save process would be to mark that field "yes" and then change the form back to not allow edits.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top