PDA

View Full Version : Setting a Record Readonly after updating a field



ganesh3084
06-22-2011, 04:18 AM
Hi

I created a form in access which has multiple fields.I have locked the rows prevent edit or delete after inserting the record by means of allowedits and allowdelete properties of the form.
How ever i need to change a field alone after insert.So i wrote a code in that control's key press event by raising the input box and getting the value and then im updating that field.
But after updating that field the entire record went to editable mode even after i wrote the following code.
Code:
a = InputBox("Enter the STATUS", "Option") Set db = CurrentDb() dsql = "UPDATE tbl_PaperTeam SET tbl_PaperTeam.Status = '" & a & "' WHERE tbl_PaperTeam.ID=" & txtID & "" db.Execute dsql, dbFailOnError Set db = Nothing MsgBox "Status Updated", vbCritical + vbOKOnly, "Error" Me.AllowEdits = No
After i executed the above code.all fields went to editable mode

So please assist me what should be done to make the entire record readly
after updating a single field

geekgirlau
06-29-2011, 08:08 PM
Possibly you need to reset the AllowEdits after the record has been saved - it may not have any impact if the record is currently being edited.