The Delete procedure causes FormLocked to return as Null. So the conditional If FormLocked Then evaluates to If Null Then which makes no sense. Deal with possibility of Null. Use Nz() to convert Null to some value the code can deal with.
If Nz(FormLocked, False) Then
However, the code does not 'unlock' a record. If you want users to see the record unlocked before deleting, eliminate the If FormLocked Then conditional:
Code:
Dim booLocked
Dim ctl As Control
booLocked = Nz(Me.FormLocked, 0)
For Each ctl In Me
If ctl.ControlType = acTextBox Or ctl.ControlType = acComboBox Then
ctl.Locked = booLocked
ctl.BackColor = IIf(booLocked, RGB(220, 220, 220), vbWhite) 'gray
'ctl.Enabled = Not booLocked 'alternative
End If
Next
btnDelete.Enabled = Not booLocked
RaceKnown.Enabled = Not booLocked
SearchConducted.Enabled = Not booLocked
ContrabandFound.Enabled = Not booLocked
ArrestMade.Enabled = Not booLocked
Injury.Enabled = Not booLocked
Instead of setting Locked and Backcolor properties why not Enabled property? This would achieve mostly the same effect as setting Locked and Backcolor properties. Can even use Conditional Formatting and eliminate VBA for the textbox and combobox controls.
Now the OfficerContacts form shows a #DELETED row. Need to requery the form. The form uses a dynamic parameterized query which triggers popup input because the criteria form is no longer open. I NEVER use dynamic parameterized queries. I prefer using WHERE CONDITION argument of OpenForm/OpenReport.
Sorry for making you go to the trouble of attaching a file. I did not use a Yes/No field in test and therefore did not replicate the issue. But providing file did allow further testing.