comparing field data from previous field in loop with null values

Discussion in 'ASP General' started by abbylee26@hotmail.com, Feb 14, 2006.

  1. Guest

    Im comparing values in a field while doing a loop
    if sAct<>myData(5,i) then
    At the end of the loop I make the value of sAct equal the current
    myData

    This will work when comparing other fields withing my recordset (so I
    know the statement works) but it will not work for the field I want to
    compare. The only difference with this field is that it has null
    values. Could this be the problem? if so, how do I deal with nulls?
     
    , Feb 14, 2006
    #1
    1. Advertising

  2. Guest

    I should say my code works but just completely ignors null values. I
    need it to treat nulls like anything else. My code will catch when it
    changes from A11 to B17...I also need for it to catch a change from G38
    to null

    sAct<>myData(5,i)

    What do I need to change?
     
    , Feb 14, 2006
    #2
    1. Advertising

  3. wrote:
    > Im comparing values in a field while doing a loop
    > if sAct<>myData(5,i) then
    > At the end of the loop I make the value of sAct equal the current
    > myData
    >
    > This will work when comparing other fields withing my recordset (so I
    > know the statement works) but it will not work for the field I want to
    > compare. The only difference with this field is that it has null
    > values. Could this be the problem? if so, how do I deal with nulls?


    if sAct<>myData(5,i) & "" then
    --
    Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.
     
    Bob Barrows [MVP], Feb 14, 2006
    #3
  4. Guest

    if sAct<>myData(5,i) & "" then

    This doesn't seem to work...even so the statement wouldn't really work
    here anyway.

    If for example sAct is null and myData(5,i) has a value, this statement
    would not pick up on the change. I need this trigger to go off if there
    is any change between the two objects.
     
    , Feb 14, 2006
    #4
  5. Evertjan. Guest

    wrote on 14 feb 2006 in microsoft.public.inetserver.asp.general:

    > if sAct<>myData(5,i) & "" then
    >
    > This doesn't seem to work...even so the statement wouldn't really work
    > here anyway.
    >
    > If for example sAct is null and myData(5,i) has a value, this statement
    > would not pick up on the change. I need this trigger to go off if there
    > is any change between the two objects.
    >


    if (sAct & "") <> (myData(5,i) & "") then

    [This will see a null and an emplty string as the same.]

    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
     
    Evertjan., Feb 14, 2006
    #5
  6. wrote:
    > if sAct<>myData(5,i) & "" then
    >
    > This doesn't seem to work...even so the statement wouldn't really work
    > here anyway.


    Then, I'm sorry, but you're going to have to do a better job of describing
    what "doesn't work" means. What I posted was a stab based on what I guessed
    you meant.
    >
    > If for example sAct is null and myData(5,i) has a value, this


    Oh come on!

    if sAct & "" <>myData(5,i) & "" then




    --
    Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.
     
    Bob Barrows [MVP], Feb 14, 2006
    #6
  7. Guest

    Thank you everyone...and thank you Evertjan
     
    , Feb 15, 2006
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jorgen Gustafsson
    Replies:
    4
    Views:
    599
    Jorgen Gustafsson
    Dec 12, 2003
  2. Replies:
    5
    Views:
    27,232
    Mike Schilling
    Mar 29, 2006
  3. John Devlon

    form remembers previous text-field values

    John Devlon, Oct 29, 2007, in forum: ASP .Net
    Replies:
    6
    Views:
    466
    John Devlon
    Nov 1, 2007
  4. Tradeorganizer
    Replies:
    3
    Views:
    161
    Tradeorganizer
    Feb 7, 2007
  5. Isaac Won
    Replies:
    9
    Views:
    419
    Ulrich Eckhardt
    Mar 4, 2013
Loading...

Share This Page