?
Solved

Asking for End with no open Ifs..

Posted on 2006-11-06
13
Medium Priority
?
173 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 3
13 Comments
 
LVL 54

Expert Comment

by:b0lsc0tt
ID: 17885628
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
ID: 17885641
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
ID: 17885655
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
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

 
LVL 13

Accepted Solution

by:
AngryBinary earned 2000 total points
ID: 17885743
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
ID: 17885883
@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
 
LVL 13

Expert Comment

by:AngryBinary
ID: 17885931
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
ID: 17889975
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
ID: 17890882
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
ID: 17891154
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
ID: 18043173
@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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
This article was originally published on Monitis Blog, you can check it here . Today it’s fairly well known that high-performing websites and applications bring in more visitors, higher SEO, and ultimately more sales. By the same token, downtime…
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
Suggested Courses

777 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