If Statement logic

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • maylortaylor
    New Member
    • Nov 2012
    • 72

    If Statement logic

    So I have two If statements and an overloaded function that needs to be used. I can't seem to figure out the logic for how to get this to work as i want it.

    Code:
     If IsDBNull(orderstable.Rows(0).Item("ZipCode")) Then
                        CanBeAssigned(orderstable.Rows(0).Item("County"), orderstable.Rows(0).Item("State"), orderstable.Rows(0).Item("Status").ToString.ToUpper)
                    Else
    
    
                        If CanBeAssigned(orderstable.Rows(0).Item("ZipCode"), orderstable.Rows(0).Item("Status").ToString.ToUpper) Then
    ''LOTS OF CODE THAT I DONT WANT TO POST''
    Ideally, I want the first IF to check if 'ZipCode' is Null...if it is > it uses the CanBeAssigned(c ounty,state,sta tus) function and then does the ''LOTS OF CODE THAT I DONT WANT TO POST'' ...

    ...however, if 'ZipCode' is NOT NULL then it uses the CanBeAssigned(z ipcode,status) and then proceeds to do the''LOTS OF CODE THAT I DONT WANT TO POST'' .
    Last edited by maylortaylor; Apr 16 '13, 08:28 PM. Reason: Gave more explanation of how it should work
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    I can't seem to figure out the logic for how to get this to work as i want it.
    We can't figure it out either because you haven't explained how you want it to work.

    Comment

    • Killer42
      Recognized Expert Expert
      • Oct 2006
      • 8429

      #3
      Looks to me as though you need to put your End If right after line 6, and remove the IF test on line 6. Something like...
      Code:
      If IsDBNull(orderstable.Rows(0).Item("ZipCode")) Then
        CanBeAssigned(orderstable.Rows(0).Item("County"), orderstable.Rows(0).Item("State"), orderstable.Rows(0).Item("Status").ToString.ToUpper)
      Else
        CanBeAssigned(orderstable.Rows(0).Item("ZipCode"), orderstable.Rows(0).Item("Status").ToString.ToUpper)
      End If
      ''LOTS OF CODE THAT I DONT WANT TO POST''
      Sorry if I've misunderstood the question.

      Comment

      • Killer42
        Recognized Expert Expert
        • Oct 2006
        • 8429

        #4
        Huh?

        Apart from being unindented and not flagged as code, that's exactly what I posted.

        Edit: Looks like the offending post has been removed, leaving this comment looking silly. Wish I could delete it.

        Comment

        Working...