Solved How to lock a record after pressing 'save' button

distinky

New member
Local time
Today, 20:37
Joined
Nov 22, 2022
Messages
8
hi, my main form is called Task_form and i have 5 other subforms under it. Also, the main form consists of 4 combo boxes.
im wanting to be able to input data and afterwards saving it so then it cannot be modified.
then i want a button that can allow you to update the data.

thanks (:
 
Take a look at the following form properties: AllowAdditions, AllowEdits, AllowDeletions.
Poat back if you need further help.
 
hi, ive had a look at the form properties and its still not what im aiming for. ive been messing with code so on my Save button it has

Private Sub Save_Record_Click()
DoCmd.RunCommand acCmdSaveRecord
Me!Division_Combo.Enabled = False
Me!Location_Combo.Enabled = False
Me!Department_Combo.Enabled = False
Me!Job_Combo.Enabled = False



End Sub

on the Current form its set to true.
however, when flicking throough records the fields unlock themselves
 
i do have a 'add new' record as button and im not sure if that is a issue too.

Private Sub Add_new_Click()
DoCmd.GoToRecord , , acNewRec

Me!Division_Combo.Enabled = True
Me!Location_Combo.Enabled = True
Me!Department_Combo.Enabled = True
Me!Job_Combo.Enabled = True

End Sub


im a newbie to these type of things so pleasee bare with me x)
 
Hi. Welcome to AWF!

You may need a field in your table to distinguished locked records to unlocked records. You can then use that info to manipulate the form using the Current event.
 
however, when flicking throough records the fields unlock themselves

The immediate problem is that when you "flick" through a record, you have a new "Current" event for each record, which is why you see what you have described. I'm thinking that you really want a "flag" (Y/N field, probably) to show your intention of locking or not. Except that if you do that, you can never correct an erroneous data entry. I would suggest thinking ahead on exactly how you want this to behave. At least one flag will be required but I could imagine having a special function on your form to unlock a locked record (for future updates and/or corrections.)
 

Users who are viewing this thread

Back
Top Bottom