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

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

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

    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(st rItem) & "<br />" & vbCrLf
    End If
    Next
    Response.Write "<br />" & vbCrLf


    Regards
    David


  • Bob Barrows [MVP]

    #2
    Re: If ... NOT &quot;&quot; Then .... question

    David Aldred wrote:[color=blue]
    > 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[/color]

    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(ke y)
    [color=blue]
    > If strItem = "" THEN[/color]

    Bob Barrows
    --
    Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.


    Comment

    Working...