protecting a record

mhm181

Registered User.
Local time
Tomorrow, 00:24
Joined
Sep 22, 2005
Messages
18
hi
i need to prevent my records in my form from editing or deletion.that is after cheking for accuracy. what is the best way to do this.i want to protect a record upon cheking it .but at the same time want to know how to unprotect the record.
 
Open the properties of the form.
Enabled = No
Locked = Yes
This will make all the fields read only, if thats what you want.
 
Searching the forum is a great way to discover and learn the answers to your Access programming questions.

These commands will allow you define what they can or can not do based on the True or False argument.

Me.AllowAdditions = True
Me.AllowDeletions = True
Me.AllowEdits = True

Check out the AllowAdditions Property in Access help for some more examples and options on how to control what your users can do. Use the forms OnOpen event when using these type of commands.

Search the forum for more examples on how to turn those properties on/off based on a users network name or workgroup name.

HTH
 
thank you for help. but that is locking all records , not only the selected one . is it possible to lock only a selcted record (the current record)
 
Does your db have any user password features. If so you could certainly lock a record down.
 
You may also lock individual fields on your form.
Open the properties for the specific field and use enabled=no, locked = yes
 
How do you do the checking? In the same form as the users? Or some other way? I have a db that I run a query to view the records then make it an update query that up updates a field that I use to lock the current record.

My field I update is a yes/no , so I update the records that match my queries PK to -1. When the user is on the record, my field is hidden and if its -1 it displays a label showing it locked, when really I just have it set to not enabled. My form in question is a subform, so I just dont enable the entire form.
 
mhm181 said:
thank you for help. but that is locking all records , not only the selected one . is it possible to lock only a selcted record (the current record)
You need to put your code in the forms OnCurrent event.

Also, you need to give more details as to what exactly you are trying to do [what methods and code are you using] for there are a variety of options posted here but you have not stated what and how you are trying to do [code wise].
 
my job is accounting patients expenses thru my form " expense reports". invoice batches ( one batch containg more than one invoice) are sent to me by the service providers ( hospitals) and i have to account each invoices separately ( one record for each invoice). in this case after i finish accounting one batch i will first make sure what i entered is correct then i want ( which currency i dont have it) to lock those transactions which correct to prevent edit or delete. i want to have one button on my form for locking the current record and another button to unlock the current record.
 
You will have to change the design of your form from continious to single form. You can display a subset of the records in a subform if you want the user to see the related records [related to the current record]. Then you can add a field [check box] to the record where you can lock or unlock the current record based on the value of the check box or some other value for the current record. Using a Case Select of an If statement you can use the code I posted above to prevent or allow the current record to be edited or locked. Bewarned that a locked record can not be unlock by changing the value of a field. You would have to create a command button [password protect it, etc.] to unlock the current record.
 

Users who are viewing this thread

Back
Top Bottom