Solved

Asking for End with no open Ifs..

Posted on 2006-11-06
13
163 Views
Last Modified: 2006-12-08
OK, here's the error I'm getting.


Microsoft VBScript compilation error '800a03f6'

Expected 'End'

/IntranetForms/DataWHReportHandlingFormTU.asp, line 166




Here's the code I'm using to generate the emails.  Please tell me where this missing "if" is.  Thanks!

<%
Option Explicit

Dim myMail, myBodyText
%>

<%
' Setup E-mail and send to employee...
Set myMail = Server.CreateObject("CDO.Message")

myMail.From = Request.Form("hidden_associate_email")

' Determines which e-mail address to send the info to
Function SendHelpDeskEmail()
      ' Setup E-mail and send to Human Resources department...
      Set myMail = Server.CreateObject("CDO.Message")

      myMail.From = objUpload.Form.Item(5) 'This is the assocaite's e-mail address
       myMail.To = "bptouch@healthlink.com"

      myMail.Subject = "Data Warehouse Report Handling Request"

      'Mymail.BodyFormat = 0
      myMail.MailFormat = 0

myBodyText = "HEALTHLINK DATA WAREHOUSE REPORT INFORMATION"
myBodyText = myBodyText & vbCrLf
myBodyText = myBodyText & "-------------------------------"
myBodyText = myBodyText & vbCrLf & vbCrLf
myBodyText = myBodyText & "Date Submitted: " & FormatDateTime(date,1)
myBodyText = myBodyText & vbCrLf & vbCrLf
myBodyText = myBodyText & "Name of Requestor: " & Request.Form("submittor")
      If ((Request.Form("submittor") = "")) Then
      myBodyText = myBodyText & "Name of Requestor: " & Request.Form("submittor_fname") & " " & Request.Form("submittor_mi") & " " & Request.Form("submittor_lname")
      myBodyText = myBodyText & vbCrLf
      Else If ((Request.Form("submittor") <> "")) Then
      End If
myBodyText = myBodyText & vbCrLf & vbCrLf
myBodyText = myBodyText & "Type of Report: " & Request.Form("report_type")
myBodyText = myBodyText & vbCrLf & vbCrLf
myBodyText = myBodyText & "Email of Requestor: " & Request.Form("hidden_associate_email")
myBodyText = myBodyText & vbCrLf & vbCrLf
myBodyText = myBodyText & "Name of Owner of Report: " & Request.Form("associate_name")
myBodyText = myBodyText & vbCrLf & vbCrLf
myBodyText = myBodyText & "Names of other users of Report: " & Request.Form("other_users")
myBodyText = myBodyText & vbCrLf & vbCrLf
myBodyText = myBodyText & "Location of Report: " & Request.Form("report_location")
myBodyText = myBodyText & vbCrLf & vbCrLf
myBodyText = myBodyText & "Owner Approval?: " & Request.form("OwnerApprov")
myBodyText = myBodyText & vbCrLf
myBodyText = myBodyText & "Date Approved: " & Request.Form("date_approved")
myBodyText = myBodyText & vbCrLf
myBodyText = myBodyText & "Has the report been validated?" & Request.Form("validate")
myBodyText = myBodyText & vbCrLf & vbCrLf
myBodyText = myBodyText & "Validated by: " & Request.Form("validated_by")
myBodyText = myBodyText & vbCrLf & vbCrLf
myBodyText = myBodyText & "Date Validated: " & Request.Form("validated")
myBodyText = myBodyText & vbCrLf & vbCrLf
myBodyText = myBodyText & vbCrLf
myBodyText = myBodyText & "-------------------------------"
myBodyText = myBodyText & vbCrLf & vbCrLf
myBodyText = myBodyText & "Report Categories: " & Request.Form("report_categories")
myBodyText = myBodyText & vbCrLf
myBodyText = myBodyText & "-------------------------------"
myBodyText = myBodyText & vbCrLf & vbCrLf
myBodyText = myBodyText & "Report Frequency: " & Request.Form("Report_Freq")
myBodyText = myBodyText & vbCrLf
myBodyText = myBodyText & "Scheduled Weekly: " & Request.Form("week_freq")
myBodyText = myBodyText & vbCrLf
myBodyText = myBodyText & "Scheduled Day:" & Request.Form("day")
myBodyText = myBodyText & vbCrLf
myBodyText = myBodyText & "Scheduled Time:" & Request.Form("hour") & ":" & Request.Form(min) & Request.Form(AM_PM)
myBodyText = myBodyText & vbCrLf
myBodyText = myBodyText & "Reason for Other: " & Request.Form("Other")
myBodyText = myBodyText & vbCrLf
myBodyText = myBodyText & "Date of Start of Report: " & Request.Form("begin_date")
myBodyText = myBodyText & vbCrLf
myBodyText = myBodyText & "Date of End of Report: " & Request.Form("end_date")
myBodyText = myBodyText & vbCrLf
myBodyText = myBodyText & "Overwrite report each week?: " & Request.Form("overwrite")
myBodyText = myBodyText & vbCrLf
myBodyText = myBodyText & "-------------------------------"
myBodyText = myBodyText & vbCrLf & vbCrLf
myBodyText = myBodyText & "Report Data Source: " & Request.Form("RptDataSrc")
myBodyText = myBodyText & vbCrLf
myBodyText = myBodyText & "Report Purpose: " & Request.Form("reportpurpose")
myBodyText = myBodyText & vbCrLf
myBodyText = myBodyText & "Report Categories: " & Request.Form("report_categories")
myBodyText = myBodyText & vbCrLf
myBodyText = myBodyText & "Report Description : " & Request.Form("reportdesc")
myBodyText = myBodyText & vbCrLf
myBodyText = myBodyText & "-------------------------------"
myBodyText = myBodyText & vbCrLf & vbCrLf
myBodyText = myBodyText & "Field Names and Definitions"
myBodyText = myBodyText & vbCrLf
myBodyText = myBodyText & Request.Form("select01") & " " & Request.Form(fieldname01) & " - " & Request.Form(definition01)
myBodyText = myBodyText & vbCrLf
myBodyText = myBodyText & "Report Categories: " & Request.Form("report_categories")
myBodyText = myBodyText & vbCrLf
myBodyText = myBodyText & "Report Categories: " & Request.Form("report_categories")
myBodyText = myBodyText & vbCrLf
myBodyText = myBodyText & "Report Categories: " & Request.Form("report_categories")
myBodyText = myBodyText & vbCrLf
myBodyText = myBodyText & vbCrLf & vbCrLf
myBodyText = myBodyText & "Comments: " & Request.Form("comments")

myMail.TextBody = myBodyText

myMail.Send

Set myMail = Nothing
%>

<%
' Setup E-mail and send to supervisor...
Set myMail = Server.CreateObject("CDO.Message")

myMail.From = "_@wellpoint.com"
myMail.To = Request.Form("hidden_associate_email")
myMail.Subject = "Data Warehouse Report Handling Request Receipt"

'Mymail.BodyFormat = 0

myBodyText = "HEALTHLINK REFERRAL INFORMATION"
myBodyText = myBodyText & vbCrLf
myBodyText = myBodyText & "-------------------------------"
myBodyText = myBodyText & vbCrLf
myBodyText = myBodyText & "A Data Warehouse Report Handling Request Form has been submitted in your name with the following information:"
myBodyText = myBodyText & vbCrLf & vbCrLf
myBodyText = myBodyText & "Date Referral was Submitted: " & FormatDateTime(date,1)
myBodyText = myBodyText & vbCrLf & vbCrLf
myBodyText = myBodyText & "Name of Requestor: " & Request.Form("submittor")
      If ((Request.Form("submittor") = "")) Then
            myBodyText = myBodyText & "Referring Associate's Name: " & Request.Form("hidden_associate_first_name") & " " & Request.Form("hidden_associate_last_name")      
      Else If ((Request.Form("submittor") <> "")) Then
            myBodyText = myBodyText & "Name of Requestor: " & Request.Form("submittor_fname") & " " & Request.Form("submittor_mi") & " " & Request.Form("submittor_lname")
      End If      
myBodyText = myBodyText & vbCrLf
myBodyText = myBodyText & "Referring Associate's E-mail: " & Request.Form("hidden_associate_email")
myBodyText = myBodyText & vbCrLf & vbCrLf
myBodyText = myBodyText & "Contact Name: " & Request.Form("contact_name")
myBodyText = myBodyText & vbCrLf & vbCrLf
myBodyText = myBodyText & "Contact Relationship to Group: " & Request.Form("contact_relationship")
myBodyText = myBodyText & vbCrLf & vbCrLf
myBodyText = myBodyText & "Contact Phone Number: (" & Request.Form("phone_one") & ") " & Request.Form("phone_two") & "-" & Request.Form("phone_three") & " x" & Request.Form("phone_four")
myBodyText = myBodyText & vbCrLf & vbCrLf
myBodyText = myBodyText & "Contact Address: "
myBodyText = myBodyText & vbCrLf
myBodyText = myBodyText & Request.Form("contact_address_one")
myBodyText = myBodyText & vbCrLf
myBodyText = myBodyText & Request.Form("contact_city") & ", " & Request.Form("contact_state") & " " & Request.Form("contact_zip_code")
myBodyText = myBodyText & vbCrLf & vbCrLf
myBodyText = myBodyText & "Type of Plan Requested: " & Request.Form("plan_type")
myBodyText = myBodyText & vbCrLf & vbCrLf
myBodyText = myBodyText & "Number of People in Group: " & Request.Form("group_size")
myBodyText = myBodyText & vbCrLf & vbCrLf
myBodyText = myBodyText & "Comments: " & Request.Form("comments")

myMail.TextBody = myBodyText

myMail.Send

Set myMail = Nothing

%>
0
Comment
Question by:IIS6_cursed
  • 6
  • 3
13 Comments
 
LVL 54

Expert Comment

by:b0lsc0tt
Comment Utility
IIS6_cursed,

This block...

     If ((Request.Form("submittor") = "")) Then
     myBodyText = myBodyText & "Name of Requestor: " & Request.Form("submittor_fname") & " " & Request.Form("submittor_mi") & " " & Request.Form("submittor_lname")
     myBodyText = myBodyText & vbCrLf
     Else If ((Request.Form("submittor") <> "")) Then
     End If

The End if just closes the most recent one, you still have one more open.

Let me know if you have any questions or need more information.

b0lsc0tt
0
 
LVL 54

Expert Comment

by:b0lsc0tt
Comment Utility
That seems to be the only problem, but let me know if you need more help or still get an error.

bol
0
 
LVL 54

Expert Comment

by:b0lsc0tt
Comment Utility
In case my first comment doesn't point out the problem well there are 2 If statements.  The first on the first line I pasted and the one that is started with the Else If (second to the last line).  The End if on the last line will close the most recent If.
0
 
LVL 13

Accepted Solution

by:
AngryBinary earned 500 total points
Comment Utility
b0lsc0tt is technically right, however i believe it should be pointed out that in order to achieve the behavior you actually intended, rather than add another "end if", you would probably want to change the "Else If" to "ElseIf". What you've actually written is the equivalent of the following structure:

If something Then
    'something
Else
    If something else Then
    'something else
    ' "End If" missing!!! <-------- Will cause error later
End If
'Error - where was that other "End If"?

When what it looks like you want is:

If something Then
   'something
ElseIf something else Then
   'something else
End If
'This code is happy

Cheers
--Randall
0
 
LVL 54

Expert Comment

by:b0lsc0tt
Comment Utility
@Randall - Good point and thanks for correcting the mistake I repeated.  Too much time really recently in another language and I overlooked it.  Your post probably identified IIS6_cursed's real problem since it is probably all one statement.  Thanks!

bol
0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 13

Expert Comment

by:AngryBinary
Comment Utility
Indeed, VB's a real bear to get stuck with when you've grown accustomed to those { cuddly } braces :)

Randall
0
 

Author Comment

by:IIS6_cursed
Comment Utility
Actually, this is just ASP code...

and changing Else If to ElseIf did not fix the problem.  It's still looking for another "End", and if I put one at the end, it tells me this:


Microsoft VBScript compilation error '800a03f7'

Expected 'Function'

/IntranetForms/DataWHReportHandlingFormTU.asp, line 168

End



It's like it wants me to end something, then it expects me to begin something...  Please help.
0
 
LVL 13

Expert Comment

by:AngryBinary
Comment Utility
Changing "Else If" to "ElseIf" fixed one problem... but it appears there are more than one. The "Function" SendHelpDeskEmail is never closed. And End Function is needed somewhere.

The code is actually Visual Basic (that's what the "vb" stands for in the newline constants), it's just being used in the context of ASP. This is good to know when seeking documentation on syntax.

I've replaced the "else if" with "elseif" removed some of the extraneous brackets in the code, which may have caused problems, as well as added the "end function" to the end of the function. My memory doesn't serve me very well for VB<=6, but because the function is defined as a "function" and not a "sub", it may also be expecting a return value. If you get an error to that effect, change Function and End Function to Sub and End Sub, or return a value for the function.

<%
Option Explicit

Dim myMail, myBodyText

' Setup E-mail and send to employee...
Set myMail = Server.CreateObject("CDO.Message")

myMail.From = Request.Form("hidden_associate_email")

' Determines which e-mail address to send the info to
Function SendHelpDeskEmail()
     ' Setup E-mail and send to Human Resources department...
     Set myMail = Server.CreateObject("CDO.Message")

     myMail.From = objUpload.Form.Item(5) 'This is the assocaite's e-mail address
      myMail.To = "bptouch@healthlink.com"

     myMail.Subject = "Data Warehouse Report Handling Request"

     'Mymail.BodyFormat = 0
     myMail.MailFormat = 0

myBodyText = "HEALTHLINK DATA WAREHOUSE REPORT INFORMATION"
myBodyText = myBodyText & vbCrLf
myBodyText = myBodyText & "-------------------------------"
myBodyText = myBodyText & vbCrLf & vbCrLf
myBodyText = myBodyText & "Date Submitted: " & FormatDateTime(date,1)
myBodyText = myBodyText & vbCrLf & vbCrLf
myBodyText = myBodyText & "Name of Requestor: " & Request.Form("submittor")
     If ((Request.Form("submittor") = "")) Then
     myBodyText = myBodyText & "Name of Requestor: " & Request.Form("submittor_fname") & " " & Request.Form("submittor_mi") & " " & Request.Form("submittor_lname")
     myBodyText = myBodyText & vbCrLf
     ElseIf ((Request.Form("submittor") <> "")) Then
     End If
myBodyText = myBodyText & vbCrLf & vbCrLf
myBodyText = myBodyText & "Type of Report: " & Request.Form("report_type")
myBodyText = myBodyText & vbCrLf & vbCrLf
myBodyText = myBodyText & "Email of Requestor: " & Request.Form("hidden_associate_email")
myBodyText = myBodyText & vbCrLf & vbCrLf
myBodyText = myBodyText & "Name of Owner of Report: " & Request.Form("associate_name")
myBodyText = myBodyText & vbCrLf & vbCrLf
myBodyText = myBodyText & "Names of other users of Report: " & Request.Form("other_users")
myBodyText = myBodyText & vbCrLf & vbCrLf
myBodyText = myBodyText & "Location of Report: " & Request.Form("report_location")
myBodyText = myBodyText & vbCrLf & vbCrLf
myBodyText = myBodyText & "Owner Approval?: " & Request.form("OwnerApprov")
myBodyText = myBodyText & vbCrLf
myBodyText = myBodyText & "Date Approved: " & Request.Form("date_approved")
myBodyText = myBodyText & vbCrLf
myBodyText = myBodyText & "Has the report been validated?" & Request.Form("validate")
myBodyText = myBodyText & vbCrLf & vbCrLf
myBodyText = myBodyText & "Validated by: " & Request.Form("validated_by")
myBodyText = myBodyText & vbCrLf & vbCrLf
myBodyText = myBodyText & "Date Validated: " & Request.Form("validated")
myBodyText = myBodyText & vbCrLf & vbCrLf
myBodyText = myBodyText & vbCrLf
myBodyText = myBodyText & "-------------------------------"
myBodyText = myBodyText & vbCrLf & vbCrLf
myBodyText = myBodyText & "Report Categories: " & Request.Form("report_categories")
myBodyText = myBodyText & vbCrLf
myBodyText = myBodyText & "-------------------------------"
myBodyText = myBodyText & vbCrLf & vbCrLf
myBodyText = myBodyText & "Report Frequency: " & Request.Form("Report_Freq")
myBodyText = myBodyText & vbCrLf
myBodyText = myBodyText & "Scheduled Weekly: " & Request.Form("week_freq")
myBodyText = myBodyText & vbCrLf
myBodyText = myBodyText & "Scheduled Day:" & Request.Form("day")
myBodyText = myBodyText & vbCrLf
myBodyText = myBodyText & "Scheduled Time:" & Request.Form("hour") & ":" & Request.Form(min) & Request.Form(AM_PM)
myBodyText = myBodyText & vbCrLf
myBodyText = myBodyText & "Reason for Other: " & Request.Form("Other")
myBodyText = myBodyText & vbCrLf
myBodyText = myBodyText & "Date of Start of Report: " & Request.Form("begin_date")
myBodyText = myBodyText & vbCrLf
myBodyText = myBodyText & "Date of End of Report: " & Request.Form("end_date")
myBodyText = myBodyText & vbCrLf
myBodyText = myBodyText & "Overwrite report each week?: " & Request.Form("overwrite")
myBodyText = myBodyText & vbCrLf
myBodyText = myBodyText & "-------------------------------"
myBodyText = myBodyText & vbCrLf & vbCrLf
myBodyText = myBodyText & "Report Data Source: " & Request.Form("RptDataSrc")
myBodyText = myBodyText & vbCrLf
myBodyText = myBodyText & "Report Purpose: " & Request.Form("reportpurpose")
myBodyText = myBodyText & vbCrLf
myBodyText = myBodyText & "Report Categories: " & Request.Form("report_categories")
myBodyText = myBodyText & vbCrLf
myBodyText = myBodyText & "Report Description : " & Request.Form("reportdesc")
myBodyText = myBodyText & vbCrLf
myBodyText = myBodyText & "-------------------------------"
myBodyText = myBodyText & vbCrLf & vbCrLf
myBodyText = myBodyText & "Field Names and Definitions"
myBodyText = myBodyText & vbCrLf
myBodyText = myBodyText & Request.Form("select01") & " " & Request.Form(fieldname01) & " - " & Request.Form(definition01)
myBodyText = myBodyText & vbCrLf
myBodyText = myBodyText & "Report Categories: " & Request.Form("report_categories")
myBodyText = myBodyText & vbCrLf
myBodyText = myBodyText & "Report Categories: " & Request.Form("report_categories")
myBodyText = myBodyText & vbCrLf
myBodyText = myBodyText & "Report Categories: " & Request.Form("report_categories")
myBodyText = myBodyText & vbCrLf
myBodyText = myBodyText & vbCrLf & vbCrLf
myBodyText = myBodyText & "Comments: " & Request.Form("comments")

myMail.TextBody = myBodyText

myMail.Send

Set myMail = Nothing

' Setup E-mail and send to supervisor...
Set myMail = Server.CreateObject("CDO.Message")

myMail.From = "_@wellpoint.com"
myMail.To = Request.Form("hidden_associate_email")
myMail.Subject = "Data Warehouse Report Handling Request Receipt"

'Mymail.BodyFormat = 0

myBodyText = "HEALTHLINK REFERRAL INFORMATION"
myBodyText = myBodyText & vbCrLf
myBodyText = myBodyText & "-------------------------------"
myBodyText = myBodyText & vbCrLf
myBodyText = myBodyText & "A Data Warehouse Report Handling Request Form has been submitted in your name with the following information:"
myBodyText = myBodyText & vbCrLf & vbCrLf
myBodyText = myBodyText & "Date Referral was Submitted: " & FormatDateTime(date,1)
myBodyText = myBodyText & vbCrLf & vbCrLf
myBodyText = myBodyText & "Name of Requestor: " & Request.Form("submittor")
     If ((Request.Form("submittor") = "")) Then
          myBodyText = myBodyText & "Referring Associate's Name: " & Request.Form("hidden_associate_first_name") & " " & Request.Form("hidden_associate_last_name")    
     ElseIf ((Request.Form("submittor") <> "")) Then
          myBodyText = myBodyText & "Name of Requestor: " & Request.Form("submittor_fname") & " " & Request.Form("submittor_mi") & " " & Request.Form("submittor_lname")
     End If    
myBodyText = myBodyText & vbCrLf
myBodyText = myBodyText & "Referring Associate's E-mail: " & Request.Form("hidden_associate_email")
myBodyText = myBodyText & vbCrLf & vbCrLf
myBodyText = myBodyText & "Contact Name: " & Request.Form("contact_name")
myBodyText = myBodyText & vbCrLf & vbCrLf
myBodyText = myBodyText & "Contact Relationship to Group: " & Request.Form("contact_relationship")
myBodyText = myBodyText & vbCrLf & vbCrLf
myBodyText = myBodyText & "Contact Phone Number: (" & Request.Form("phone_one") & ") " & Request.Form("phone_two") & "-" & Request.Form("phone_three") & " x" & Request.Form("phone_four")
myBodyText = myBodyText & vbCrLf & vbCrLf
myBodyText = myBodyText & "Contact Address: "
myBodyText = myBodyText & vbCrLf
myBodyText = myBodyText & Request.Form("contact_address_one")
myBodyText = myBodyText & vbCrLf
myBodyText = myBodyText & Request.Form("contact_city") & ", " & Request.Form("contact_state") & " " & Request.Form("contact_zip_code")
myBodyText = myBodyText & vbCrLf & vbCrLf
myBodyText = myBodyText & "Type of Plan Requested: " & Request.Form("plan_type")
myBodyText = myBodyText & vbCrLf & vbCrLf
myBodyText = myBodyText & "Number of People in Group: " & Request.Form("group_size")
myBodyText = myBodyText & vbCrLf & vbCrLf
myBodyText = myBodyText & "Comments: " & Request.Form("comments")

myMail.TextBody = myBodyText

myMail.Send

Set myMail = Nothing
End Function
%>
0
 
LVL 54

Expert Comment

by:b0lsc0tt
Comment Utility
AngryBinary is correct about ASP.  It is actually a "technology" and the most common language used is vbscript.  It can also support jscript or javascript although they are not common.  When ASP is used as a language name vbscript is usually assumed.

You should be fine with Function once you get it closed.  An ASP function does not need to return a value although for a value to be returned in vbscript it must have the name of the function.  What you are doing in that block of code is probably more of a routine though.

Let us know if you still have a problem but AngryBinary was correct when stating the other error was just a second problem not a sign that the fix he suggested was wrong.

bol
0
 
LVL 54

Expert Comment

by:b0lsc0tt
Comment Utility
@PinalDave - AngryBinary solved the problem in http:Q_22051095.html#17885743.  Another problem appeared which IIS6_cursed asked about and AngryBinary answered in http:Q_22051095.html#17890882.  I would recommend closing this by accepting those 2 comments.  I added a little info and did help some but AngryBinary got it right.  That's just my suggestion.  I hope it helps.  Let me know if there are any questions.

bol
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
"In order to have an organized way for empathy mapping, we rely on a psychological model and trying to model it in a simple way, so we will split the board to three section for each persona and a scenario and try to see what those personas would Do,…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now