CFF KB - Carrz-Fox-Fire Promotions Knowledge Base
CFF KB is all about 1 thing: The Sharing of Knowledge and the Power we gain from it.Knowledge Base
- Breadrumbs:
Microsoft VBScript compilation error '800a0412' Must be first statement on the line
- Article ID:
154 - Date Created
Wednesday, December 21, 2011 - Last Updated
Wednesday, December 21, 2011 - This Article Has been Viewed
3088 times - Short Desc
When you are creating your script for CDOSYS Email, you may run into this error, when you are adding in if statements into your code, to show or not show a specific thing to a client message. - Details
When you are creating your script for HTMLBody Email for CDOSYS emails, you may run into a situation, where you will need to send data that is generated from your database.
When using IF and ELSEIF Statements in your CDOSYS code, for the HTMLBody message, it can get a little touchy, and does take some expertise in order to write the code out properly.
And then, there are sometimes, that not matter how much experience one may have, error and issues will arise themselves.
In that case, you have to separate your<%
myMail.HTMLBody = myMail.HTMLBody & "Information goes here" & vbCrLf _
%>
Working with your database with generated emails, makes your work a lot easier, and more simplified, than sending out individual emails to your clientele.
The below error happens when you forget to close a line above an ELSE or ELSEIF statement.
Microsoft VBScript compilation error '800a0412'
Must be first statement on the line
/NewPost.asp, line 95
else
^ - Recreate Issue
To recreate this issue.<%
if rsNew.eof then
myMail.HTMLBody=myMail.HTMLBody & "Information goes here" & vbCrLf _
else
myMail.HTMLBody=myMail.HTMLBody & "another line of information goes here" & vbCrLf
end if
%>
Looking at the above code example, on the 2nd line of code, the & vbCrLf _ is making the 3rd line, which is our ELSE, into a 3rd line, instead of a first line. - Resolve Issue
To resolve this issue.<%
if rsNew.eof then
myMail.HTMLBody=myMail.HTMLBody & "Information goes here" & vbCrLf
else
myMail.HTMLBody=myMail.HTMLBody & "another line of information goes here" & vbCrLf
end if
%>
As you can see in the above corrected example, we have removed the _ (underscore) from the ending of the vbCrLf, so that it is now the end of the line, and the ELSE if the beginning of the line.
Share With Friends (Updated 6-8-2010)
Recent Articles
All Topics
- Coming Soon - Knowledge Exchange
Trending Articles
- Microsoft VBScript runtime error '800a0046' Permission denied FileSystemObject 24695
- Microsoft OLE DB Provider for SQL Server error '80040e57' String or binary data would be truncated. or The field is too small to accept the amount of data you attempted to add. Try inserting or pasting less data. 21297
- ADODB.Parameters error '800a0e7c' Parameter object is improperly defined 19544
- After Effects warning: Audio conforming failed for the following file .cfa. Perhaps due to disk space 17785
- The backup set holds a backup of a database other than the existing 16825