Private Sub Form_Load()
Dim ctls As Controls
Dim ctl As Control
Set ctls = Me.Controls
For Each ctl In ctls
If ctl.ControlType <> acLabel Then
ctl.OnGotFocus = "=AllOnGotFocus('" & ctl.Name & "')"
End If
Next ctl
End Sub
Function AllOnGotFocus(ctlname As String)
Dim ctls As Controls
Set ctls = Me.Controls
If IsNull(ctls(ctlname).Value) = True Then
ctls(ctlname).Locked = False
Else
ctls(ctlname).Locked = True
End If
End Function