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

Problem with ELSEIF

Status
Not open for further replies.

coachdan

MIS
Mar 1, 2002
269
US
I am getting a syntax error on an ASP (using vbscript) page, the error is thrown on the last ELSEIF line (delete). This statement is spread out throughout the page code, but I copy/pasted it all together in one spot. The code was existing when I took this job, but I believe it is setting a flag depending on whether the "update" link is clicked or the "delete" link. It will determine whether an update query is run or a delete query. Does anyone see an error in the syntax? If not, can anyone offer another way to write the statement (maybe a case select)?

Code:
Actionvar=Request.QueryString("actionvar")

IF Actionvar="update" THEN
  IF Len(TRIM(Request.Form("flag"))) = 0 THEN

ELSEIF Request.Form("flag")="2" THEN

ELSEIF Actionvar="delete" THEN

END IF
END IF

coachdan32

 
try this instead...
Code:
IF Actionvar="update" THEN
  IF Len(TRIM(Request.Form("flag"))) = 0 THEN

  ELSEIF Request.Form("flag")="2" THEN

  END IF
ELSEIF Actionvar="delete" THEN

END IF

Tony
reddot.gif WIDTH=500 HEIGHT=2 VSPACE=3

 
Hey there

which IF goes to which ELSFEIF is the question I think

i don't see any END's there

is this the structure?

Code:
IF Actionvar="update" THEN

  	IF Len(TRIM(Request.Form("flag"))) = 0 THEN
		...........
	ELSEIF Request.Form("flag")="2" THEN
		...........
	ELSE
	    ...........
	END IF	
	
ELSEIF Actionvar="delete" THEN
	...........
ELSE
	...........
END IF

___________________________________________________________________

The answer to your ??'s may be closer then you think.
Check out Tek-Tips knowledge bank by clicking the FAQ link at the top of the page
 
[lol]

this is starting to get common place....me being slow that is

___________________________________________________________________

The answer to your ??'s may be closer then you think.
Check out Tek-Tips knowledge bank by clicking the FAQ link at the top of the page
 
It is very difficult to tell the structure because it is very intertwined within the coding. I went through the code and pulled out every IF, For, Do While and Select Case statement in the code. Does anyone see a mismatched statement?


Code:
Actionvar=Request.QueryString("actionvar")


'****************** UPDATE ***************************
'


IF Actionvar="update" THEN
  IF Len(TRIM(Request.Form("flag"))) = 0 THEN

    IF NOT RS.EOF THEN
Select Case varMonth 
	
End Select
Select Case varMonth 
	
End Select
Select Case varMonth 
	
End Select
Select Case varMonth 
	
End Select
Select Case varMonth 
	
End Select
Select Case varMonth 
	
End Select
Select Case varMonth 
	
End Select

'*********Add Row 1 Input Boxes************
'
 For y1 = 1 to 7

 

	  	For x = 0 to Ubound
	  	Next

Next

Select Case varMonth 
	
End Select
Select Case varMonth 
	
End Select
Select Case varMonth 
	
End Select
Select Case varMonth 
	
End Select
Select Case varMonth 
	
End Select
Select Case varMonth 
	
End Select
Select Case varMonth 
	
End Select
'*********Add Row 2 Input Boxes************
'

 For y1 = 1 to 7

		For x = 0 to Ubound
		Next
		
Next
Select Case varMonth 
	
End Select
Select Case varMonth 
	
End Select
Select Case varMonth 
	
End Select
Select Case varMonth 
	
End Select
Select Case varMonth 
	
End Select
Select Case varMonth 
	
End Select
Select Case varMonth 
	
End Select
'*********Add Row 3 Input Boxes**********
'

 For y1 = 1 to 7
		For x = 0 to Ubound
		Next
		
Next
Select Case varMonth 
	
End Select
Select Case varMonth 
	
End Select
Select Case varMonth 
	
End Select
Select Case varMonth 
	
End Select
Select Case varMonth 
	
End Select
Select Case varMonth 
	
End Select
Select Case varMonth 
	
End Select
'*******Add Row 4 Input Boxes**********
'
For y1 = 1 to 7
		For x = 0 to Ubound
		Next
		
Next
Select Case varMonth 
	
End Select
Select Case varMonth 
	
End Select
Select Case varMonth 
	
End Select
Select Case varMonth 
	
End Select
Select Case varMonth 
	
End Select
Select Case varMonth 
	
End Select
Select Case varMonth 
	
End Select
'********Add Row 5 Input Boxes***********
'
For y1 = 1 to 7
		For x = 0 to Ubound
		Next
		
Next
Select Case varMonth 
	
End Select
Select Case varMonth 
	
End Select
Select Case varMonth 
	
End Select
Select Case varMonth 
	
End Select
Select Case varMonth 
	
End Select
Select Case varMonth 
	
End Select
Select Case varMonth 
	
End Select
'*************Add Row 6 Input Boxes************
'
For y1 = 1 to 7
		For x = 0 to Ubound
		Next
		Next

 End if
END IF
ELSEIF Request.Form("flag")="2" THEN

‘*******Validation Section**************
‘

If varU1 = " " Then
varU1 = varU1DB
End If
If varU2 = " " Then
	varU2 = varU2DB
End If
If varU3 = " " Then
	varU3 = varU3DB
End If
If varU4 = " " Then
	varU4 = varU4DB
End If
If varU5 = " " Then
	varU5 = varU5DB
End If
If varU6 = " " Then
	varU6 = varU6DB
End If
If varU7 = " " Then
	varU7 = varU7DB
End If
If varU8 = " " Then
	varU8 = varU8DB
End If
If varU9 = " " Then
	varU9 = varU9DB
End If
If varU10 = " " Then
	varU10 = varU10DB
End If
If varU11 = " " Then
	varU11 = varU11DB
End If
If varU12 = " " Then
varU12 = varU12DB
End If
If varU13 = " " Then
	varU13 = varU13DB
End If
If varU14 = " " Then
	varU14 = varU14DB
End If
If varU15 = " " Then
	varU15 = varU15DB
End If
If varU16 = " " Then
	varU16 = varU16DB
End If
If varU17 = " " Then
	varU17 = varU17DB
End If
If varU18 = " " Then
	varU18 = varU18DB
End If
If varU19 = " " Then
	varU19 = varU19DB
End If
If varU20 = " " Then
	varU20 = varU20DB
End If
If varU21 = " " Then
	varU21 = varU21DB
End If
If varU22 = " " Then
	varU22 = varU22DB
End If
If varU23 = " " Then
	varU23 = varU23DB
End If
If varU24 = " " Then
	varU24 = varU24DB
End If
If varU25 = " " Then
	varU25 = varU25DB
End If
If varU26 = " " Then
	varU26 = varU26DB
End If
If varU27 = " " Then
	varU27 = varU27DB
End If
If varU28 = " " Then
	varU28 = varU28DB
End If
If varU29 = " " Then
	varU29 = varU29DB
End If
If varU30 = " " Then
	varU30 = varU30DB
End If
If varU31 = " " Then
	varU31 = varU31DB
End If
If varU32 = " " Then
	varU32 = varU32DB
End If
If varU33 = " " Then
	varU33 = varU33DB
End If
If varU34 = " " Then
	varU34 = varU34DB
End If
If varU35 = " " Then
	varU35 = varU35DB
End If
If varU36 = " " Then
	varU36 = varU36DB
End If
If varU37 = " " Then
	varU37 = varU37DB
End If
If varU38 = " " Then
	varU38 = varU38DB
End If
If varU39 = " " Then
	varU39 = varU39DB
End If
If varU40 = " " Then
	varU40 = varU40DB
End If
If varU41 = " " Then
	varU41 = varU41DB
End If
If varU42 = " " Then
	varU42 = varU42DB
End If

'************************** LOAD DATA INTO DB ***********************
'


If varBusName = "Citi" Then
Select Case varYrA
End Select
Else
Select Case varYrA
End Select
End If

‘*****Confirmation Section********
‘

If varYrA = "2002" Then
Response.Write "<HR><H2>Operation Complete</H2><HR><BR><BR><A HREF=TAUCALAE.asp?Yr=2002>Return to Main Add/Edit Page</A>"
End If

If varYrA = "2003" Then
Response.Write "<HR><H2>Operation Complete</H2><HR><BR><BR><A HREF=TAUCALAE.asp?Yr=2003>Return to Main Add/Edit Page</A>"
End If

If varYrA = "2004" Then
Response.Write "<HR><H2>Operation Complete</H2><HR><BR><BR><A HREF=TAUCALAE.asp?Yr=2004>Return to Main Add/Edit Page</A>"
End If

If varYrA = "2005" Then
Response.Write "<HR><H2>Operation Complete</H2><HR><BR><BR><A HREF=TAUCALAE.asp?Yr=2005>Return to Main Add/Edit Page</A>"
End If

If varYrA = "2006" Then
Response.Write "<HR><H2>Operation Complete</H2><HR><BR><BR><A HREF=TAUCALAE.asp?Yr=2006>Return to Main Add/Edit Page</A>"
End If

If varYrA = "2007" Then
Response.Write "<HR><H2>Operation Complete</H2><HR><BR><BR><A HREF=TAUCALAE.asp?Yr=2007>Return to Main Add/Edit Page</A>"
End If

If varYrA = "2008" Then
Response.Write "<HR><H2>Operation Complete</H2><HR><BR><BR><A HREF=TAUCALAE.asp?Yr=2008>Return to Main Add/Edit Page</A>"
End If

If varYrA = "2009" Then
Response.Write "<HR><H2>Operation Complete</H2><HR><BR><BR><A HREF=TAUCALAE.asp?Yr=2009>Return to Main Add/Edit Page</A>"
End If

If varYrA = "2010" Then
Response.Write "<HR><H2>Operation Complete</H2><HR><BR><BR><A HREF=TAUCALAE.asp?Yr=2010>Return to Main Add/Edit Page</A>"
End If


END IF



'************************ DELETE *****************************


ELSEIF Actionvar="delete" THEN

If varYrA = "2002" Then
Response.Write "<HR><H2>Operation Complete</H2><HR><BR><BR><A HREF=TAUCALAE.asp?Yr=2002>Return to Main Add/Edit Page</A>"
End If

If varYrA = "2003" Then
Response.Write "<HR><H2>Operation Complete</H2><HR><BR><BR><A HREF=TAUCALAE.asp?Yr=2003>Return to Main Add/Edit Page</A>"
End If

If varYrA = "2004" Then
Response.Write "<HR><H2>Operation Complete</H2><HR><BR><BR><A HREF=TAUCALAE.asp?Yr=2004>Return to Main Add/Edit Page</A>"
End If

If varYrA = "2005" Then
Response.Write "<HR><H2>Operation Complete</H2><HR><BR><BR><A HREF=TAUCALAE.asp?Yr=2005>Return to Main Add/Edit Page</A>"
End If

If varYrA = "2006" Then
Response.Write "<HR><H2>Operation Complete</H2><HR><BR><BR><A HREF=TAUCALAE.asp?Yr=2006>Return to Main Add/Edit Page</A>"
End If

If varYrA = "2007" Then
Response.Write "<HR><H2>Operation Complete</H2><HR><BR><BR><A HREF=TAUCALAE.asp?Yr=2007>Return to Main Add/Edit Page</A>"
End If

If varYrA = "2008" Then
Response.Write "<HR><H2>Operation Complete</H2><HR><BR><BR><A HREF=TAUCALAE.asp?Yr=2008>Return to Main Add/Edit Page</A>"
End If

If varYrA = "2009" Then
Response.Write "<HR><H2>Operation Complete</H2><HR><BR><BR><A HREF=TAUCALAE.asp?Yr=2009>Return to Main Add/Edit Page</A>"
End If

If varYrA = "2010" Then
Response.Write "<HR><H2>Operation Complete</H2><HR><BR><BR><A HREF=TAUCALAE.asp?Yr=2010>Return to Main Add/Edit Page</A>"
End If

'********************** LOAD DEFAULT PAGE *******************
'

ELSE
	For x = 0 to Ubound
	Next
	
If varVBULC = "" Then

Else
DO WHILE NOT rs.EOF
 LOOP
 END IF
END IF

coachdan32

 
Looking at the sections that are pretty clear cut that they are unrelated to the actionvar process, I have removed what I believe to be statements that should not be considered as part of the problem. This is what's left and I believe the root of the problem exists in this part of the code. Can anyone spot a problem or offer another solution?

Code:
Actionvar=Request.QueryString("actionvar")


'****************** UPDATE ***************************
'


IF Actionvar="update" THEN
IF Len(TRIM(Request.Form("flag"))) = 0 THEN

    
END IF
ELSEIF Request.Form("flag")="2" THEN

END IF


ELSEIF Actionvar="delete" THEN

ELSE
END IF
END IF

coachdan32

 
END IF only at the end of the IF

Code:
IF Actionvar="update" THEN
 IF Len(TRIM(Request.Form("flag"))) = 0 THEN
 ELSEIF Request.Form("flag")="2" THEN
 ELSEIF Actionvar="delete" THEN
 ELSE
 END IF
END IF

ttmug.gif
 
foxbox, that would make the ELSEIF Actionvar="delete" THEN redundant. How about this?
Code:
IF Actionvar="update" THEN
  IF Len(TRIM(Request.Form("flag"))) = 0 THEN

  ELSEIF Request.Form("flag")="2" THEN

  END IF

ELSEIF Actionvar="delete" THEN

ELSE

END IF

Tony
reddot.gif WIDTH=500 HEIGHT=2 VSPACE=3

 
There was an extra "End if" in the code. I have gotten past that issue and the page comes up without error now, but there are other problems with what data is being pulled and some issues with it's graphical appearance. I thank everyone that helped. I am going to spend some time looking at the new issues and if necessary I will open a new thread on the new issues.

coachdan32

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top