I want to prevent accidental updates to records

M

Michael Fine

I am running Access 2000.

I would like to put a simple check box on a form so that if the box is
checked that record cannot be edited. If you uncheck the box, the
record can be edited.

Is there a simple way to do this.

TIA
 
J

John Crighton

Yes.

On the open form property, set the check box to 0.

On the 'on click' property of the check box, check the
state of the box and use myForm.AllowEdits = True or
False accordingly.

HTH

John C
 
J

John Vinson

I am running Access 2000.

I would like to put a simple check box on a form so that if the box is
checked that record cannot be edited. If you uncheck the box, the
record can be edited.

Is there a simple way to do this.

TIA

Yes; a little bit of code in the Form's BeforeUpdate event will do the
trick. Open the form in design view, put an unbound checkbox named
chkOKTosave on it. Then view the Form's Properties, and find the
"Before Update" property on the Events tab; click the ... icon by it
and choose the Code Builder. The code should be something like:

Private Sub Form_BeforeUpdate(Cancel as Integer)
If Me!chkOKToSave = False Then
MsgBox "Review your work, then check the OK To Save box"
Cancel = True
End If
End Sub
 

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