Locking a specific field of a specific record

sho ryu ken

Registered User.
Local time
Today, 20:00
Joined
Aug 12, 2005
Messages
15
Hello, I have just spent ages doing searches and reading everything I can on locking. But, I have yet to find an answer as to how I can lock a specific field in a specific record.

e.g. Staff enter customer details, then at the end of the day the admin (me) checks it over and presses a big old button that stops them from locking certain fields in the current record only - they must still have access to the unlocked fields of the current record, and it must not lock any other records.

I'm guessing there's some VB code in the form of fieldname.lock = true, but then it locks the field throughout the whole table!

Can anyone tell me how to do this please?
 
Here's a thought...

Add a yes/no field in the table. Use a checkbox rather than a button on the form bound to the field. If the checkbox is checked then the control of your choice is locked, not enabled, not visible, or whatever you want.
 
ok, thanks, good idea. Do you know how to make it so only the admin can view the check box?
 
Set the visible value of the checkbox to no
In the form onload event place this:

If Environ("username") = "Admin" Then

YourcheckBox.Visible = True

Else
YourcheckBox.Visible = False
 
Last edited:
thanks jr jr... maybe theres something I missed, but this system locks the fields throughout the whole table. I need to lock fields in specific records :confused:
 
You are accessing the data through a form correct?

You need to lock only the one form control that you want. Again, set the enabled value to no and use code that states that if the checkbox is checked then the control on your form is not enabled. That will lock only that single control.
 
what I mean is, say I lock (or disable) the customer surname on record 2 to stop employees screwing it up, then it will lock the surname field in every record for the whole database.
 
Sounds like you didn't bind the checkbox on the form to the field in the table.

Edit,
Check out the attachment
 

Attachments

Last edited:
I ran that example and have messed about with it and understood it thoroughly, thanks, but it has exactly the same problem as I have:

All these options, visible, locked, etc. ... they affect every record throughout the whole table/form. e.g. If I lock field2 of record 1, then field2 of record 3 will also be locked, and field2 of record 4, and 5, and so on. I want to be able to lock specific fields in ONLY in specified records.
 
Actually there is an example in that db that does what you want. Look at the auto lock again. This disables due to having a value in the textbox rather than a checkbox checked but the princilple is the same. Also look at oncurrent of the form.

Is the checkbox on your form bound to anything yet??

edit:
If you really need me to I will create another db for you to look at. This one is just one that I already had. I am betting that you figure it out now :D
 
Last edited:
Man, I've finally nailed it. It was the 'oncurrent' thing that I was overlooking (I always wondered how to run instructions when you change record). Thanks very much JRJR for your time and patience.
 
You're welcome, glad it worked out for you.
On a side note, if your form is bound to a table, you really should use a query instead. It will provide a lot more versatility.
 

Users who are viewing this thread

Back
Top Bottom