Modify Edd/Add Record/Deletion Properties of Form and Child Subfor

  • Thread starter Thread starter Access User
  • Start date Start date
A

Access User

Hi,

I have a form and a correlated sub-form. I want to prevent the data enterer
from modifying the form unintentionally when he clicks a check box
"Completed". I tried some simple VBA in the "Completed" control's "On Click"
property but it had the effect of also freezing the user out of un-checking
the same control if the need were to arise later on.

What's the right way to approach that? Anyone?

TIA.
 
If it's a thing of being able to uncheck the box when needed, you can place a
button on the form to have it unfreeze the checkbox when clicked. OR if it is
a controlled thing, use a password field and a button so when the password is
entered, click the button and it release the freeze. If it is for editing
purposes only you may want to make it so it only activate on current record
so once you leave the record, it will freeze the checkbox up again. Just a
few ideas to ponder on.
 
The name of the form was "MRA Form" and here's the VBA; assumes -1 = "Yes"
and 0 = "No" on a check-box. When user clicks on check-box ("Complete" is its
name), I want it disable edits/additions/deleteions to that form's data but
to continue to allow user the ability to un-check "Complete" checkbox down
the road if user seiously needs to update or modify the record behind the
form. I hadn't mentioned this but there's a correlated sub-form (name I don't
recall at this moment) on this form and I think it'd be good if the
"Complete" check-box prevented further modifications to the data the
sub-form/table.

Private Sub Complete_Click()

If Me.Complete = -1 Then
Me.Form.AllowEdits = False
Me.Form.AllowAdditions = False
Me.Form.AllowDeletions = False
Me.Complete.Enabled = True

End If

If Me.CommandBeforeExecute = 0 Then
Me.Form.AllowEdits = True
Me.Form.AllowAdditions = True
Me.Form.AllowDeletions = True
Me.Complete.Enabled = True

End If

End Sub
 
Hi,

At this point, passwords are probably more than's needed, but on the other
point in your mention, I would think that there would be a way to exclude a
control from an overall freezing of controls on a form but if there is it
escapes me how. Are you saying that somehow, if controls like checkboxes are
not exemptable from some sort of form-wide freezing of controls that buttons
ARE?

Currently, I'm punting and have just worked with modifying the color of the
control's label, so I'm using the following VBA

Private Sub Complete_AfterUpdate()

If Me.Complete = -1 Then
Me![Label59].BackColor = vbGreen
Me![Label59].ForeColor = vbBlack
End If
If Me.Complete = 0 Then
Me![Label59].BackColor = vbRed
Me![Label59].ForeColor = vbYellow
End If

End Sub

and also

Private Sub Form_Current()

If Me.Complete = -1 Then
Me![Label59].BackColor = vbGreen
Me![Label59].ForeColor = vbBlack
End If
If Me.Complete = 0 Then
Me![Label59].BackColor = vbRed
Me![Label59].ForeColor = vbYellow
End If

End Sub
 
Back
Top