OK - I know this is a silly question, but I cannot figure it out. I am trying to build in some error trapping on a data entry form. This form requires the user to enter various information, including several numbers (integers). The default value is 0 for the number fields. However, if the user deletes an entry in a number field (creating a nil value --> not zero but nil) then I want the form to automatically replace the nil with a 0. Here is the code I came up with:
Private Sub Com1_LostFocus()
If Com1 = "" Then
Forms!Rev_Add!Com1 = 0
End If
End Sub
The problem is that the statement is not recognizing the "" value when it occurs. I think it has something to do with Com1 being defined as an integer, but I am not sure. Any ideas?
Private Sub Com1_LostFocus()
If Com1 = "" Then
Forms!Rev_Add!Com1 = 0
End If
End Sub
The problem is that the statement is not recognizing the "" value when it occurs. I think it has something to do with Com1 being defined as an integer, but I am not sure. Any ideas?