nested ifs and end ifs and elses

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

    nested ifs and end ifs and elses

    still working on this DB :o(

    I have..

    a query that I run, if this query is unsuccessful then another query is run
    on another table, it goes something like this


    if rs1.EOF then '1st query returns nothing

    response.write "nothing in this table"

    'so check the other table
    strSQL = "SELECT * blah blah
    rs.Open strSQL, Conn, 1

    if rs.EOF then '2nd query also returns nothing
    response.write "nothing in this table either"

    else

    do while not rs.EOF
    reg = rs("reg_num")
    l_read = rs("last_read" )
    response.write blah blah

    end if

    else

    do while not rs1.EOF
    strname = rs1("user_name" )
    response.write blah blah

    rs1.movenext
    loop

    end if

    but I get an expected statement (end if) error

    I'm looking at my code it it seems to conform to the correct structure

    if condition1 then
    code block1
    if condition2 then
    codeblock2
    else
    codeblock3
    end if
    else
    codeblock4
    end if

    should I perhaps have used elseif??


  • Alistair

    #2
    Re: nested ifs and end ifs and elses

    'tis ok.

    I've found it....a missing loop

    always find it after I post a request for help


    Comment

    • F@yy@Z

      #3
      Re: nested ifs and end ifs and elses

      what about "loop" ?

      loop syntex is missing in one of your do while statement. Try it may be it
      works if not let us know.



      "Alistair" <forget_it> wrote in message
      news:109hgova96 cmj10@corp.supe rnews.com...[color=blue]
      > still working on this DB :o(
      >
      > I have..
      >
      > a query that I run, if this query is unsuccessful then another query is[/color]
      run[color=blue]
      > on another table, it goes something like this
      >
      >
      > if rs1.EOF then '1st query returns nothing
      >
      > response.write "nothing in this table"
      >
      > 'so check the other table
      > strSQL = "SELECT * blah blah
      > rs.Open strSQL, Conn, 1
      >
      > if rs.EOF then '2nd query also returns nothing
      > response.write "nothing in this table either"
      >
      > else
      >
      > do while not rs.EOF
      > reg = rs("reg_num")
      > l_read = rs("last_read" )
      > response.write blah blah
      >
      > end if
      >
      > else
      >
      > do while not rs1.EOF
      > strname = rs1("user_name" )
      > response.write blah blah
      >
      > rs1.movenext
      > loop
      >
      > end if
      >
      > but I get an expected statement (end if) error
      >
      > I'm looking at my code it it seems to conform to the correct structure
      >
      > if condition1 then
      > code block1
      > if condition2 then
      > codeblock2
      > else
      > codeblock3
      > end if
      > else
      > codeblock4
      > end if
      >
      > should I perhaps have used elseif??
      >
      >[/color]


      Comment

      Working...