Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Problem with Null value

lineardialoguelineardialogue Member Posts: 1
Hello, I have what seems to be a simple problem, but I cannot get anything to work. I have a textbox on a form that if null I want to have a msbox appear and the code to stop. I have put in the below code. When I step into the program i can see that the msgbox does = null and that null = null, but it still skips over the statement as if it was false. Please help anyone. Thanks.

If Me.Text121 = Null Then
MsgBox "Enter in 'Time Completed'."
Exit Sub
End If

Comments

  • dokken2dokken2 Member Posts: 532
    : Hello, I have what seems to be a simple problem, but I cannot get
    : anything to work. I have a textbox on a form that if null I want to
    : have a msbox appear and the code to stop. I have put in the below
    : code. When I step into the program i can see that the msgbox does =
    : null and that null = null, but it still skips over the statement as
    : if it was false. Please help anyone. Thanks.
    :
    : If Me.Text121 = Null Then
    : MsgBox "Enter in 'Time Completed'."
    : Exit Sub
    : End If
    :

    use the IsNull function-

    If IsNull(Me.Text121.Value) Then
    MsgBox "Enter in 'Time Completed'."
    Exit Sub
    End If

Sign In or Register to comment.