Locking Form and Subform-What am I doing wrong?

G

Guest

Okay, I have a form that includes a checkbox "Closed_Check", when this box is
checked I need to lock that specific record in the form and subform.
Currently I've tried:

If Closed_Check = True Then
Me.AllowEdits = False
Me.AllowDeletions = False
Else
Me.AllowEdits = True
Me.AllowDeletions = True
End If

and placed this in the On Current event field for both the form and subform.
It works, problem is it locks the following records that are not closed.

What am I missing?
HELP
 
G

Guest

then what is a person to do?
I have the check box there for when an item is closed (naturally to stop
someone from editing by mistake)
The form is a single form view and the subform is a datasheet. They are
linked by a JEID#.
 
D

Douglas J. Steele

Put that code in the form's Current event.

Yes, that will either lock every row or unlock every row. However, you can't
change a row unless it's the active row, and putting the code in the Current
event insures that whether or not the form is locked depends on the current
row.
 

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

Similar Threads

Mandatory Fields 4
Lock records against edits 3
Locking a record via a form 2
Can't get code to run 3
Setting form properties 7
Creating new record in subform 1
Locking a record 2
delete code, subform 1

Top