Null

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Brenda

    #1

    Null



    I am trying to write an "If" statement that looks like this.
    If LName = Null Then
    MsgBox "Last name can not be left blank"
    End If
    I can not get it to recognize Null. What is wrong with the statement,
    or should be used instead of null.

    Thank you,
    Brenda

    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
  • Damon Heron

    #2
    Re: Null

    if isnull(LName) then..........

    Damon
    "Brenda" <brenda@mycolle geinfo.com> wrote in message
    news:4123ddfc$0 $14430$c397aba@ news.newsgroups .ws...[color=blue]
    >
    >
    > I am trying to write an "If" statement that looks like this.
    > If LName = Null Then
    > MsgBox "Last name can not be left blank"
    > End If
    > I can not get it to recognize Null. What is wrong with the statement,
    > or should be used instead of null.
    >
    > Thank you,
    > Brenda
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
    > Don't just participate in USENET...get rewarded for it![/color]


    Comment

    • Steve Jorgensen

      #3
      Re: Null

      For more details, see my reply to the recent thread on optional parameters and
      IsMissing.

      On Wed, 18 Aug 2004 16:48:49 -0700, "Damon Heron" <damon327@hotma il.com>
      wrote:
      [color=blue]
      >if isnull(LName) then..........
      >
      >Damon
      >"Brenda" <brenda@mycolle geinfo.com> wrote in message
      >news:4123ddfc$ 0$14430$c397aba @news.newsgroup s.ws...[color=green]
      >>
      >>
      >> I am trying to write an "If" statement that looks like this.
      >> If LName = Null Then
      >> MsgBox "Last name can not be left blank"
      >> End If
      >> I can not get it to recognize Null. What is wrong with the statement,
      >> or should be used instead of null.
      >>
      >> Thank you,
      >> Brenda
      >>
      >> *** Sent via Developersdex http://www.developersdex.com ***
      >> Don't just participate in USENET...get rewarded for it![/color]
      >[/color]

      Comment

      • Pieter Linden

        #4
        Re: Null

        use IsNull(variable )

        Comment

        • Terry Kreft

          #5
          Re: Null


          Others have pointed out IsNull, from the way you describe the error your
          trying to detect I think you may be better off with

          If Len(Trim(LName & "")) < 1 Then
          MsgBox "Last name can not be left blank"
          End If

          This will detect when
          a) No entry is made (LName Is Null)
          b) An empty string is entered (data has been entered and then deleted
          gives rise to this)
          c) Someone just taps the space bar


          --
          Terry Kreft
          MVP Microsoft Access


          "Brenda" <brenda@mycolle geinfo.com> wrote in message
          news:4123ddfc$0 $14430$c397aba@ news.newsgroups .ws...[color=blue]
          >
          >
          > I am trying to write an "If" statement that looks like this.
          > If LName = Null Then
          > MsgBox "Last name can not be left blank"
          > End If
          > I can not get it to recognize Null. What is wrong with the statement,
          > or should be used instead of null.
          >
          > Thank you,
          > Brenda
          >
          > *** Sent via Developersdex http://www.developersdex.com ***
          > Don't just participate in USENET...get rewarded for it![/color]


          Comment

          Working...