On my form if the user enters a 0 in text box TR_2, then text box TR_3 becomes invisible. However, if the user enters a value in TR_3 and then enters a 0 in TR_2, TR_3 will contain invalid data. To prevent this, I put in a sub before update to change the value of TR_3 to Null if TR_2 contains a 0. this works, but if any other value is entered in TR_3, it changes to a 3.
The code is:
Private Sub Form_BeforeUpdate(Cancel As Integer)
If Me.TR_2.Value = 0 Then
Me.TR_3.Value = Null
Else
Me.TR_3.Value = 0 Or 1 Or 2
End If
End Sub
I don't understand what is happening or how to fix it.
Can anyone help?
Henry
The code is:
Private Sub Form_BeforeUpdate(Cancel As Integer)
If Me.TR_2.Value = 0 Then
Me.TR_3.Value = Null
Else
Me.TR_3.Value = 0 Or 1 Or 2
End If
End Sub
I don't understand what is happening or how to fix it.
Can anyone help?
Henry