If...Then...Else and IsNull : IsNull « Data Type Functions « VBA / Excel / Access / Word






If...Then...Else and IsNull

 
Sub cmdIfThenElse()
 Dim txtName As String
 Dim txtAge As String
 
 If IsNull(txtName) Or IsNull(txtAge) Then
    msgBox "Name or Age is Blank"
  Else
    msgBox "Your Name Is " & txtName & " And Your Age Is " & txtAge
  End If
End Sub

 








Related examples in the same category

1.Working with Null
2.Loop through all of the records in the recordset for non-null value