robman70
Technical User
- Aug 6, 2002
- 90
I'm having problems with empty textboxes. Sometimes some of the textboxes are blank and I want the program to accept that but instead it either will tell me 'invalid use of null' or 'type mismatch'.
In the beginning i wanted null, but at this point i dont care anymore just anything blank will work, i just need it to accept a blank value. any help is appreciated
Code:
' This is the Invalid use of null:
Private Sub Command1_Click()
Dim intNumber As Integer
If Text1.Text = "" Then
intNumber = Null
Else
intNumber = Text1.Text
End If
End Sub
Code:
' This is the type mismatch
Private Sub Command1_Click()
Dim intNumber As Integer
If Text1.Text = "" Then
intNumber = ""
Else
intNumber = Text1.Text ' or CInt(Text1.Text)
End If
End Sub
In the beginning i wanted null, but at this point i dont care anymore just anything blank will work, i just need it to accept a blank value. any help is appreciated