Link to home
Start Free TrialLog in
Avatar of IIS6_cursed
IIS6_cursed

asked on

Asking for End with no open Ifs..

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

%>
Avatar of b0lsc0tt
b0lsc0tt
Flag of United States of America image

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
That seems to be the only problem, but let me know if you need more help or still get an error.

bol
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.
ASKER CERTIFIED SOLUTION
Avatar of AngryBinary
AngryBinary

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
@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
Avatar of AngryBinary
AngryBinary

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

Randall
Avatar of IIS6_cursed

ASKER

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.
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
%>
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
@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