function including loop statment with texbox condition.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Fary4u
    Contributor
    • Jul 2007
    • 273

    function including loop statment with texbox condition.

    using db connection displaying values into text box,
    including multiple loop statement, to show dynamic text box by incrementing text name.
    Code:
    function PopulateComboBS(rsBS,sIDColBS) 
     i = 1
      do while not rsBS.eof and i < 10
        nPKBS = rsBS.fields(sIDColBS).value
    sResBS = sResBS & "<input size=2 name=st"& i & " type=text value=" & nPKBS & "><br/>"
        rsBS.MoveNext
       i=i+1
      loop
    PopulateComboBS = sResBS
    end function
    record showing following result.
    Code:
    <input size=2 name=st1 type=text value=x><br/>
    <input size=2 name=st2 type=text value=x><br/>
    <input size=2 name=st3 type=text value=x><br/>
    <input size=2 name=st4 type=text value=x><br/>
    db only got 4 result but to show rest of the text box,
    need condition to finish all the text box using the same following procedure ( name=st5,st6,st 7,st8,st9 ) with blank values?
    Code:
    <input size=2 name=st5 type=text value=><br/>
    <input size=2 name=st6 type=text value=><br/>
    <input size=2 name=st7 type=text value=><br/>
    <input size=2 name=st8 type=text value=><br/>
    <input size=2 name=st9 type=text value=><br/>
    Hope that makes sense
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    Use a second loop to go from the record count + 1 to 10.

    Comment

    • Fary4u
      Contributor
      • Jul 2007
      • 273

      #3
      best to check record set 1st and then record count.
      Code:
      sResBS.MoveFirst
       while not sResBS.EOF and i < 10
         sResBS = sResBS & "<input size=2 name=st"& i & " type=text value=" & nPKBS & "><br/>"
       sResBS.MoveNext
        i=i+1
         wend
      works for me :)

      Comment

      Working...