If ... NOT "" Then .... question

D

David Aldred

Got a bit of code, which I want to loop through, unless the current value is
"", in which case I need ti to skip to the next one, but how do I do it?

Response.Write "<br />" & vbCrLf
For Each strItem In Request.Form
If strItem = "" THEN
'these next two lines, I only want to be processed if the above does
have a value in it.
Response.Write "-" & strItem & "-" & vbCrLf
Response.Write "-" & Request.Form(strItem) & "<br />" & vbCrLf
End If
Next
Response.Write "<br />" & vbCrLf


Regards
David
 
B

Bob Barrows [MVP]

David said:
Got a bit of code, which I want to loop through, unless the current
value is "", in which case I need ti to skip to the next one, but how
do I do it?

Response.Write "<br />" & vbCrLf
For Each strItem In Request.Form

strItem, being the key to the Form variables collection, will NEVER be
blank. I suspect you actually want to test the content of the Form
variables, rather than the variable names. To do that, you would do this:

For each key in request.form
strItem = Request.Form(key)
If strItem = "" THEN

Bob Barrows
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,765
Messages
2,569,568
Members
45,042
Latest member
icassiem

Latest Threads

Top