If check the box, how to disable further edits

NikkCol

New member
Local time
Yesterday, 17:03
Joined
Nov 16, 2011
Messages
8
Can someone help me?
For closed projects have a check box to formulate all my closed projects.
However, I need to make sure no one is able to add or edit any projects that are closed.
I only know how to disable edits for the form itself but not per project number and anything associate with that project number assigned.

Can you help me? Need to do this as soon as possible.
 
In the Form's On Current event you could use;
Code:
    If Me.YourCheckName = True Then [COLOR="Green"]'True can also be tested as -1 the negative can be tested as 0 or False[/COLOR]
        Me.AllowEdits = False
    Else
        Me.AllowEdits = True
    End If
 
Last edited:
Sounds like you may need to control the use of the checkbox as well as the editing of projects. The way JBB describes above will work fine if users can't use the CheckBox, but if they are free to uncheck it thereby allowing edits, you will be no better off. You could have a password to lock or unlock the checkbox (the default state of the checkbox will be Locked) that will allow only you or anyone that knows the password to unlock it and then to check or uncheck it. By using the On Enter or On GotFocus event you could use something like:
If InputBox("Enter password") = "YourPassword" then
Me.YourCheckName.Locked = False
Else
Me.YourCheckName.Locked = True
Endif
David
 
There is no need to do anything to the check box, as once it is checked and the Form's Allow Edits property is set to False the user can not uncheck it. Now that could be a problem if they inadvertently check the check box so perhaps the following, in the Check Box's On Click event would be better;
Code:
    If Me.Check = True Then
        If MsgBox("Are you sure you wish to lock this record?", vbYesNo, "Warning") = vbNo Then
            Me.Undo
            Exit Sub
        End If

        Me.AllowEdits = False
        Me.Dirty = False
    Else
        Me.AllowEdits = True
    End If
You would still need the code presented in my previous post in the Form's On Current event
 
Last edited:

Users who are viewing this thread

Back
Top Bottom