I am currently in the process of setting up an asp page that sends an inquiring student an email regarding his/her application status. The student enters his/her email address on a web page, the address is associated with the correspponding record in a sql database table, and an email is generated and sent to them based on app status. I am focusing on the "Incomplete " portion which will list all null fields from the table in the email. Using the code below works fine, although as soon as I insert a Select Case statement to determine what type of email should be sent, my null fields disappear from the email. An email is still sent, but without the list of null fields. Any ideas? Thanks.
Currently my asp script is sending email just fine along with the correct null fields from my database. The only problem I am having is using 'select case' statements. I have one field in this table that distinguishes if an application is complete. There are three options, (Complete, Incomplete, Under Review). I would like the script to check these values and send the appropriate email. The null field email would go with the Incomplete application email. The other two just would send out a general email letting them know their status. Any time I setup a select case statement around the code, the emails cease to show the null fields anymore. Any ideas? Here is my latest code:
<%
Dim Applicant
Set Applicant = Request.Form("t xtEmailAddress" )
Dim oRs, oField, fieldCount, FName, Status
Set oRs = Server.CreateOb ject("ADODB.Rec ordset")
oRs.Open "vwAcademicsDat a WHERE Email = '" & Applicant & "';","DSN=O SC"
Set FName = oRs("First_Name ")
Set Status = oRs("Applicatio nStatus")
sMsg = sMsg & "Greetings " & FName & "!" & vbCRLF & vbCRLF
sMsg = sMsg & "Your application to the College has been received." & vbCRLF & vbCRLF
sMsg = sMsg & "Any missing items on your application are listed below:" & vbCRLF & vbCRLF
For Each oField In oRs.Fields
If IsNull( oRs( oField.name ) ) Then
sMsg = sMsg & oField.name & VbCrLf
End If
Next
Dim Mail
Set Mail = CreateObject("C DONTS.NewMail")
Mail.From = "user@college.e du"
Mail.To = Applicant
Mail.Bcc = "helpdesk@colle ge.edu"
Mail.Subject = "Your Admission Status"
Mail.Body = sMsg
Mail.Send
oRs.Close
Set oRs = Nothing
%>
Currently my asp script is sending email just fine along with the correct null fields from my database. The only problem I am having is using 'select case' statements. I have one field in this table that distinguishes if an application is complete. There are three options, (Complete, Incomplete, Under Review). I would like the script to check these values and send the appropriate email. The null field email would go with the Incomplete application email. The other two just would send out a general email letting them know their status. Any time I setup a select case statement around the code, the emails cease to show the null fields anymore. Any ideas? Here is my latest code:
<%
Dim Applicant
Set Applicant = Request.Form("t xtEmailAddress" )
Dim oRs, oField, fieldCount, FName, Status
Set oRs = Server.CreateOb ject("ADODB.Rec ordset")
oRs.Open "vwAcademicsDat a WHERE Email = '" & Applicant & "';","DSN=O SC"
Set FName = oRs("First_Name ")
Set Status = oRs("Applicatio nStatus")
sMsg = sMsg & "Greetings " & FName & "!" & vbCRLF & vbCRLF
sMsg = sMsg & "Your application to the College has been received." & vbCRLF & vbCRLF
sMsg = sMsg & "Any missing items on your application are listed below:" & vbCRLF & vbCRLF
For Each oField In oRs.Fields
If IsNull( oRs( oField.name ) ) Then
sMsg = sMsg & oField.name & VbCrLf
End If
Next
Dim Mail
Set Mail = CreateObject("C DONTS.NewMail")
Mail.From = "user@college.e du"
Mail.To = Applicant
Mail.Bcc = "helpdesk@colle ge.edu"
Mail.Subject = "Your Admission Status"
Mail.Body = sMsg
Mail.Send
oRs.Close
Set oRs = Nothing
%>
Comment