IF not working

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • 2D Rick

    #1

    IF not working

    Access2003
    txtSN_Qty is an unbound textbox that gets a number typed in if greater
    than one(1) else its left blank.

    If txtSN_Qty is left blank then the below line should jump the code to
    ELSE, but it does not.

    If txtSN_Qty <"" Or Not IsNull(txtSN_Qt y) Then


    Placing a Watch on txtSN_Qty shows its value as "" (an empty string
    when left blank)

    Why is my IF not working?

    Thanks,
    RICK

  • Queezy

    #2
    Re: IF not working

    On Apr 3, 10:32 am, "2D Rick" <rbrown...@comp userve.comwrote :
    Access2003
    txtSN_Qty is an unbound textbox that gets a number typed in if greater
    than one(1) else its left blank.
    >
    If txtSN_Qty is left blank then the below line should jump the code to
    ELSE, but it does not.
    >
    If txtSN_Qty <"" Or Not IsNull(txtSN_Qt y) Then
    >
    Placing a Watch on txtSN_Qty shows its value as "" (an empty string
    when left blank)
    >
    Why is my IF not working?
    >
    Thanks,
    RICK

    Your IF statement works.
    Something else must be out of line.
    Also I don't believe you need the first part of your IF.
    This should work by itself -
    If Not IsNull(txtSN_Qt y) Then

    Comment

    • storrboy

      #3
      Re: IF not working


      If the box is "" it satisfies the Not IsNull part of the statement,
      regardless of what the first is. Either use AND instead of OR, or try
      using the Nz Function.

      If Nz(txtSN_Qty,"" ) = "" 'If null or empty
      Then....
      Else.... 'Contains a literal value
      End If

      Comment

      • 2D Rick

        #4
        Re: IF not working

        On Apr 3, 7:52 am, "Queezy" <que...@gmail.c omwrote:
        On Apr 3, 10:32 am, "2D Rick" <rbrown...@comp userve.comwrote :
        >
        >
        >
        >
        >
        Access2003
        txtSN_Qty is an unbound textbox that gets a number typed in if greater
        than one(1) else its left blank.
        >
        If txtSN_Qty is left blank then the below line should jump the code to
        ELSE, but it does not.
        >
        If txtSN_Qty <"" Or Not IsNull(txtSN_Qt y) Then
        >
        Placing a Watch on txtSN_Qty shows its value as "" (an empty string
        when left blank)
        >
        Why is my IF not working?
        >
        Thanks,
        RICK
        >
        Your IF statement works.
        Something else must be out of line.
        Also I don't believe you need the first part of your IF.
        This should work by itself -
        If Not IsNull(txtSN_Qt y) Then- Hide quoted text -
        >
        - Show quoted text -
        Thanks, I'll try it.
        What an amazing thing this forum. Killer response time.
        Rick

        Comment

        • 2D Rick

          #5
          Re: IF not working

          On Apr 3, 8:04 am, "storrboy" <storr...@sympa tico.cawrote:
          If the box is "" it satisfies the Not IsNull part of the statement,
          regardless of what the first is. Either use AND instead of OR, or try
          using the Nz Function.
          >
          If Nz(txtSN_Qty,"" ) = "" 'If null or empty
          Then....
          Else.... 'Contains a literal value
          End If
          I like Nz, it works as advertised.
          What an amazing thing this forum. Killer response time.
          Rick

          Comment

          Working...