Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Nested If with WHILE WEND

Status
Not open for further replies.

rossmcl

Programmer
Apr 18, 2000
128
How do I do the following:<br><br>If blah &gt; 5 Then<br>Do Something<br>ElseIf specialname is contained in recordset (of names) <br>Do Something***<br>Else<br>Do Something Else<br>End If<br><br>How do I do the ElseIf? Do I have to scroll through the recordset to see if specialname is in the recordset ofnames? How do I do this?<br>Do I have to use WHILE/WEND?<br><br>Your help would be (as always) much appreciated?<br><br>Thanks<br>Ross
 
Ross, <br>&nbsp;&nbsp;&nbsp;&nbsp;It's really hard to answer such a general question without knowing what the rest of the code looks like, the size of the recordset, etc.&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;From what you posted here,&nbsp;&nbsp;it looks like you'll be looping through the entire recordset for every record.&nbsp;&nbsp;This will be painfully slow unless the recordset is tiny.<br> <p>nick bulka<br><a href=mailto: > </a><br><a href= > </a><br>
 
Nick,<br>the recordset is going to be five records. I basically want to check that the name is not already in the field in the name column of the five rows.<br>Is this an effective way of doing it.<br>Again I am used to doing this in Access, thought it would be as fast as doing it there for such a small recordset?<br><br>Thanks in Advance<br><br>Ross<br><br>Also do you know of any good beginner sites for CSS (i presume that stands for style sheets)?<br><br>(I come to your posts via the hyperlink that I get in a mail notification - does not seem to have the thing where I can say the post was useful?) Or am I just blind?
 
hi ross!<br><br>instead of reading all data into a recordset and then scan it completely via asp i would use a sql query to check for a specific name. or do you have to process each record anyway?<br><br>also i know an excellent ressource for css,html and js but it is a german tutorial so i think it won't help, will it?<br>
 
Hi rpet,<br>Querying for the specific name would work, only how do I recognise if it has not been found (ie if the query has 0 records)?<br><br>Nein, I dont know any German, thanks! <br><br>Ross
 
hi ross!<br><br>it's easy:<br><br><FONT FACE=monospace><br>[...]<br>Set RS = CON.Execute(yourSelectStatement)<br><br>If RS.EOF Then<br>&nbsp;'* no records found<br>Else<br>&nbsp;'* records found<br>End If<br>[...]<br></font><br><br>where CON is your ADOBD.Connection. this should work.<br><br><br><br>
 
Ross,<br>&nbsp;&nbsp;&nbsp;About getting to the forum through the hyperlinks,&nbsp;&nbsp;&nbsp;I had never tried that, but you're right.&nbsp;&nbsp;The link to mark the post is not included when you come here using that method.&nbsp;&nbsp;I'll bring this up with the moderators.<br>&nbsp;&nbsp;&nbsp;Will rpet's solution work for you?<br><br>For CSS help, goto <A HREF=" TARGET="_new"> and click on &quot;style sheets&quot; <p>nick bulka<br><a href=mailto: > </a><br><a href= > </a><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top