Results 1 to 4 of 4
  1. #1
    virgilio is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Nov 2019
    Posts
    81

    What value is in a new record, new field?

    What value is in an untouched field in a new record?

    I thought it was Null, but this test is telling me it isn't..

    Code:
    Private Sub initialActivity_Click()
       Dim tempInitAct As Variant
       
       tempInitAct = Nz([INITIAL_ACTIVITY])
       
       If tempInitAct = Null Then
          MsgBox ("ia = null " & tempInitAct)
       Else
          MsgBox ("ia <> null " & tempInitAct)
       End If
       
    End Sub
    Clicking that box gives me "ia <> null ". (Google search is unproductive.)

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,530
    Try:
    Private Sub initialActivity_Click() Dim tempInitAct As Variant

    tempInitAct = Nz([INITIAL_ACTIVITY])

    If IsNull(tempInitAct) = True Then
    MsgBox ("ia = null " & tempInitAct)
    Else
    MsgBox ("ia <> null " & tempInitAct)
    End If

    End Sub
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    virgilio is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Nov 2019
    Posts
    81
    That still returns "ia <> null" for me. I came up with a work around, but I'm still open to suggestions as to why this is failing for me.

  4. #4
    virgilio is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Nov 2019
    Posts
    81
    I found the reason, i NZ'd it so it contained zero. I don't know why it didn't show up in the box as zero, but the isNull() is working as expected otherwise. Thank you Bob!

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 02-28-2019, 03:49 PM
  2. Replies: 7
    Last Post: 01-04-2018, 06:35 PM
  3. Replies: 1
    Last Post: 01-13-2014, 12:11 AM
  4. Replies: 3
    Last Post: 08-18-2013, 01:15 PM
  5. Replies: 2
    Last Post: 12-21-2012, 01:57 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums