I had an issue with the posted db (Method or Data Member not found). Perhaps it depends on another db for a library reference. Anyway, this does work provided the control names match.
Code:
Private Sub textbox1_AfterUpdate()
If Not IsNullEmpty(Me.textbox1) Then
DisableControl Me.textbox3, True
DisableControl Me.textbox4, True
Else
DisableControl Me.textbox3, False
DisableControl Me.textbox4, False
End If
End Sub
Private Sub textbox2_AfterUpdate()
If Not IsNullEmpty(Me.textbox2) Then
DisableControl Me.textbox3, True
DisableControl Me.textbox4, True
Else
DisableControl Me.textbox3, False
DisableControl Me.textbox4, False
End If
End Sub
Private Sub textbox3_AfterUpdate()
If Not IsNullEmpty(Me.textbox3) Then
DisableControl Me.textbox1, True
DisableControl Me.textbox2, True
DisableControl Me.textbox4, True
Else
DisableControl Me.textbox1, False
DisableControl Me.textbox2, False
DisableControl Me.textbox4, False
End If
End Sub
Private Sub textbox4_AfterUpdate()
If Not IsNullEmpty(Me.textbox4) Then
DisableControl Me.textbox1, True
DisableControl Me.textbox2, True
DisableControl Me.textbox3, True
Else
DisableControl Me.textbox1, False
DisableControl Me.textbox2, False
DisableControl Me.textbox3, False
End If
End Sub
Private Sub DisableControl(ctl As Control, mode As Boolean)
If mode = False Then 'control is not to be disabled
ctl.Enabled = True
Else
ctl.Enabled = False
End If
End Sub
and if this function is in a standard module (could be in the form module as well, but then can't be used by any other db code)
Code:
Public Function IsNullEmpty(ctl As Control) As Boolean
IsNullEmpty = False
If IsNull(ctl) Or ctl = "" Then IsNullEmpty = True
End Function
As long as you have a way of navigating off of the only enabled control when you want to delete its contents. Tab will work, but not all users may know that.
Feel free to lock instead of disable.