Lock Down past years records so they cannot be changed (1 Viewer)

bali3377

Registered User.
Local time
Today, 02:52
Joined
Jan 31, 2010
Messages
13
Is there any way I can lock all records made before a certain date (in this case my year end date) so that accidental changes cannot be made.
 

Steve R.

Retired
Local time
Today, 05:52
Joined
Jul 5, 2006
Messages
4,760
There are a couple of ways to do this. One is to have a logical (Boolean) field as an indicator for whether the record is locked or not. Another approach is to use the datediff function in a form to determine if the record should be locked or not.
 

bali3377

Registered User.
Local time
Today, 02:52
Joined
Jan 31, 2010
Messages
13
The boolean field as an indicator sounds interesting. I am not a programmer in as much as I just use the MS manual for Access - I could do SQL if its just copy and paste jobs - can you further explain this function or is it not suitable for my level.
 

Steve R.

Retired
Local time
Today, 05:52
Joined
Jul 5, 2006
Messages
4,760
You will have to some of your own research and code experimentation. I will assume that you have a "main" table for holding the basic information. Create a logical (Boolean) field in that table. Set it so that when it is "false", any form that opens a record will allow field editing. When "true" all the fields in the forms would be "locked". You would do this test in the forms "On Current" event.

You will also need to use the "Datediff" function to compute whether the logical field is set to true or false. This can be done through either a forms "On Current" event or through VBA code. Your choice.

Technically, setting the logical field on the forms "On Current" event would not be considered optimal since it would duplicate the function of the logical field. Doing it through VBA code allows you to set the value of logical field at a time of your choosing.
 

Users who are viewing this thread

Top Bottom