Results 1 to 8 of 8

Thread: [RESOLVED] [Access 2002] Null evaluating to true in opposite comparisons

Threaded View

  1. #1

    Thread Starter
    Banned
    Join Date
    Nov 2005
    Posts
    2,367

    Resolved [RESOLVED] [Access 2002] Null evaluating to true in opposite comparisons

    I have the following code:
    VB Code:
    1. Private Sub Form_Load()
    2.     If Me.OpenArgs = Null Then      
    3.         DoCmd.GoToRecord , , acNewRec
    4.     Else                              
    5.             'Do something else
    6.     End If
    7. End Sub
    Everytime I step through it, it drops to the else clause. If I flip the comparison to:
    VB Code:
    1. Private Sub Form_Load()
    2.     If Me.OpenArgs <> Null Then      
    3.         DoCmd.GoToRecord , , acNewRec
    4.     Else                              
    5.             'Do something else            
    6.     End If
    7. End Sub
    It still drops to the else clause. I checked the value of Me.OpenArgs to see what it actually is:


    What am I doing wrong here? How can it not be either true or false?

    My first thought was that Null is only used to compare objects (like in VB.Net), but the immediate value told me otherwise.

    Thanks!
    Last edited by sevenhalo; Jul 18th, 2006 at 06:06 PM. Reason: Changed to "not be either" for clarity.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width