Locking down a record

T

the_abcs

I have a form that several people enter data into (probably 40 fields) I need
to lock it down so no editing can take place when a certain checkbox is
checked. There is a button they can click to open another for to enter
comments on, I need this button to be enable though. Everything else on the
form needs to be uneditable.
Thanks for your help!
Ann
 
K

Klatuu

Not easily. Each user has his/her own instance of Access running on their
own computer, even if you are committing the unpardonable sin of multiple
users sharing the same copy on a shared folder.
You could have a table that would tell if someone is using the form and use
the form's Open event to check a field in the table and Lock the controls if
someone is using the form. You would want to use a numeric field and add 1
to the field so the form could be opened for editing only if the field is 0.

But, I would advise against doing this.

What is it you want to accomplish? Why do you want to allow only one user
to use the form at a time? If you can describe the business rules for this,
perhaps there is a better way.
 
T

the_abcs

I don't want only one person in it at a time, I want no one to be able to
edit it after it has been created and approved. When the "approved" checkbox
is checked I need the functionality in place so that no edits to cost, or qty
can occur.
Sorry for my bad explanantion the first time.
Thanks!
 
K

Klatuu

Oh, okay, I totally missed what you are asking.
Use the Form Current event to check for the value of the Approved field. If
it is true, then disable and lock the controls you don't want edited:

Private Sub Form_Current()

With Me
If .NewRecord Or Not .txtApproved Then
.SomeControl.Enabled = False
.SomeControl.Locked = True
.AnotherControl.Enabled = False
.AnotherControl.Locked = True
Else
.SomeControl.Enabled = True
.SomeControl.Locked = False
.AnotherControl.Enabled = True
.AnotherControl.Locked = False
End If
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top