By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,659 Members | 1,742 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,659 IT Pros & Developers. It's quick & easy.

function including loop statment with texbox condition.

Fary4u
100+
P: 273
using db connection displaying values into text box,
including multiple loop statement, to show dynamic text box by incrementing text name.
Expand|Select|Wrap|Line Numbers
  1. function PopulateComboBS(rsBS,sIDColBS) 
  2.  i = 1
  3.   do while not rsBS.eof and i < 10
  4.     nPKBS = rsBS.fields(sIDColBS).value
  5. sResBS = sResBS & "<input size=2 name=st"& i & " type=text value=" & nPKBS & "><br/>"
  6.     rsBS.MoveNext
  7.    i=i+1
  8.   loop
  9. PopulateComboBS = sResBS
  10. end function
  11.  
record showing following result.
Expand|Select|Wrap|Line Numbers
  1. <input size=2 name=st1 type=text value=x><br/>
  2. <input size=2 name=st2 type=text value=x><br/>
  3. <input size=2 name=st3 type=text value=x><br/>
  4. <input size=2 name=st4 type=text value=x><br/>
  5.  
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,st7,st8,st9 ) with blank values?
Expand|Select|Wrap|Line Numbers
  1. <input size=2 name=st5 type=text value=><br/>
  2. <input size=2 name=st6 type=text value=><br/>
  3. <input size=2 name=st7 type=text value=><br/>
  4. <input size=2 name=st8 type=text value=><br/>
  5. <input size=2 name=st9 type=text value=><br/>
  6.  
Hope that makes sense
May 31 '12 #1

✓ answered by Fary4u

best to check record set 1st and then record count.
Expand|Select|Wrap|Line Numbers
  1. sResBS.MoveFirst
  2.  while not sResBS.EOF and i < 10
  3.    sResBS = sResBS & "<input size=2 name=st"& i & " type=text value=" & nPKBS & "><br/>"
  4.  sResBS.MoveNext
  5.   i=i+1
  6.    wend  
  7.  
works for me :)

Share this Question
Share on Google+
2 Replies


Rabbit
Expert Mod 10K+
P: 12,370
Use a second loop to go from the record count + 1 to 10.
May 31 '12 #2

Fary4u
100+
P: 273
best to check record set 1st and then record count.
Expand|Select|Wrap|Line Numbers
  1. sResBS.MoveFirst
  2.  while not sResBS.EOF and i < 10
  3.    sResBS = sResBS & "<input size=2 name=st"& i & " type=text value=" & nPKBS & "><br/>"
  4.  sResBS.MoveNext
  5.   i=i+1
  6.    wend  
  7.  
works for me :)
Jun 12 '12 #3

Post your reply

Sign in to post your reply or Sign up for a free account.