what is wrong with this code RRS feed

  • Question

  • Private Sub DateIn_Enter()
    If IsEmpty(Me.DateIn) Then
        Me.DateIn = Date
    End If
    If IsEmpty(Me.TimeIn) Then
        Me.TimeIn = Time()
    End If

    End Sub
    Wednesday, May 31, 2017 4:19 PM

All replies

  • Hi Jenni,

    What makes you think there is something wrong with the code? Are you getting an error message?

    IsEmpty() is used to check if a variable has been initialized. If you're trying to check whether a control on a form is "empty" or not, you might be able to use the IsNull() function. For example:

    If IsNull(Me.DateIn) Then


    If Nz(Me.DateIn,"") = "" Then


    If Not IsDate(Me.DateIn) Then

    Hope it helps...

    Wednesday, May 31, 2017 4:49 PM