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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Expected Statement - End If

Status
Not open for further replies.

endoflux

Technical User
Aug 6, 2001
227
0
0
US
I'm using an IF statement to check for a valid data type, and redirecting to another page (url stored in a variable) if its invalid. I'm getting an "Expected Statement" error when I use "End If", and I can't figure out why...ideas?

Thanks!

Code:
If vartype(Request.Form("quantity")) <> "2" Then Response.Redirect ReDir3
End If


Error:
Microsoft VBScript compilation error '800a0400'

Expected statement

/test/newsln/new_post_sln.asp, line 41

End If
^
 
If vartype(Request.Form("quantity")) <> "2" Then
Response.Redirect ReDir3
End If


Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
That produces the following:

Code:
If vartype(Request.Form("quantity")) <> "2"
Then Response.Redirect ReDir3
End If

Error:
Microsoft VBScript compilation error '800a03f9'

Expected 'Then'

/test/newsln/new_post_sln.asp, line 40

If vartype(Request.Form("quantity")) <> "2"
-------------------------------------------^
 
Reread carefully my suggestion and compare it to your code ...
 
By putting it all on 1 line, it worked <scratching head>

If Not isNumeric(Request.Form("quantity")) Then Response.Redirect ReDir3 End If
 
Well, put the cursor inside the If word in your code and press the F1 key.
 
This may be silly. But I had a simular problem with a VBscript.

I don't think you need the end if with it written this way.
Code:
If vartype(Request.Form("quantity")) <> "2" Then Response.Redirect ReDir3

but would if done this way.
Code:
If vartype(Request.Form("quantity")) <> "2" Then
        Response.Redirect ReDir3
End If



Thanks

John Fuhrman
Titan Global Services
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top