Results 1 to 3 of 3

Thread: [RESOLVED] What the different with this 2 statement ?

  1. #1

    Thread Starter
    Hyperactive Member nUflAvOrS's Avatar
    Join Date
    Jul 2007
    Location
    Malaysia/ Currently at Singapore
    Posts
    372

    Resolved [RESOLVED] What the different with this 2 statement ?

    Hi all,

    I got 2 statement, logically it should be same, but the result is different.

    VB Code:
    1. Select Case rs.fields(7)
    2.   Case IsNull(rs.fields(7))
    3.       itmx.subitems(7) = ""
    4.   Case Else
    5.       itmx.listsubitems.Add , , "", 1
    6. End Select


    VB Code:
    1. If IsNull(rs.fields(7)) Then
    2.     itmx.subitems(7) = ""
    3. Else
    4.     itmx.listsubitems.Add , , "", 1
    5. End If

    Actually i need to detect the record if the record in database is null then it would not display a reporticon else it will display the report Icon. By using the if else statement the reporticon display follow record. However, if i used case statement, all the record displaying reporticon regardless the record is null or not !
    Where there is no hope, there can be no endeavor.

    There are two ways of rising in the world, either by your own industry or by the folly of others.

  2. #2
    PowerPoster
    Join Date
    Nov 2002
    Location
    Manila
    Posts
    7,629

    Re: What the different with this 2 statement ?

    In your case structure, your comparing record column value to a boolean value, if no boolean match then goto Else part. I'm guessing fields(7) is not a boolean value. It should have been (to restrict/conform to boolean test)...

    Select Case True
    Case IsNull(rs.fields(7))
    ...
    Case Else
    ...
    End Select

  3. #3

    Thread Starter
    Hyperactive Member nUflAvOrS's Avatar
    Join Date
    Jul 2007
    Location
    Malaysia/ Currently at Singapore
    Posts
    372

    Re: What the different with this 2 statement ?

    Yes resolved, that was my mistake. I learn one more thing again.. thanks
    Where there is no hope, there can be no endeavor.

    There are two ways of rising in the world, either by your own industry or by the folly of others.

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