Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Array Contents into Email Body

Status
Not open for further replies.

gi11ies

Programmer
Mar 26, 2002
52
Im trying to put the contents of an two dimensional array that is stored in a session into the body of an email that is generated, but am getting an error thrown at my for loop line.

The main parts of code I have are for the array are:

cartArray = Session("cartArray") '
intCartMaxUsed = Session("intCartMaxUsed")
intCartItem = 0

.
.
.

strBody = "First Name:" & strFirst & vbCrLf & _
"Last Name: " & strLast & vbCrLf & _
"E-mail: " & strEmail & vbCrLf & _
"Order Total: " & intOrderTotal & vbCrLf & _
"Product Price Qty Total" & vbCrLf & _
"-------------------------------------" & vbCrLf & _
For intCartItem = 0 to intCartMaxUsed
cartArray(0,intCartItem) & " " & cartArray(2,intCartItem) & " " & cartArray(3,intCartItem) & " " & cartArray(4,intCartItem) & vbCrLf & _
Next

.
.
.

sendMail strFrom, strTo, strSubject, strBody

If anyone has any advice on where I am going wrong, it would be great!

Gillies
 
try

Code:
strBody = "First Name:" & strFirst & vbCrLf & _
"Last Name: " & strLast & vbCrLf & _
"E-mail: " & strEmail & vbCrLf & _
"Order Total: " & intOrderTotal & vbCrLf & _
"Product          Price    Qty   Total" & vbCrLf & _
        "-------------------------------------" & vbCrLf 
For intCartItem = 0 to intCartMaxUsed	
 strBody = strBody & cartArray(0,intCartItem) & " " & cartArray(2,intCartItem) & " " & cartArray(3,intCartItem) & " " & cartArray(4,intCartItem) & vbCrLf
Next
 
Oh you don't want to use a line continuation character to continue onto a line that has anything but more text.

Try this instead:
Code:
strBody = "First Name:" & strFirst & vbCrLf _
        & "Last Name: " & strLast & vbCrLf _
        & "E-mail: " & strEmail & vbCrLf  _
        & "Order Total: " & intOrderTotal & vbCrLf _
        & "Product          Price    Qty   Total" & vbCrLf _
        & "-------------------------------------" & vbCrLf 

For intCartItem = 0 to intCartMaxUsed
 strBody = strBody & cartArray(0,intCartItem) & " " _
         & cartArray(2,intCartItem) & " " _
         & cartArray(3,intCartItem) & " " _
         & cartArray(4,intCartItem) & vbCrLf 
Next
 
my thoughts exactly. just didn't spit it out fast enough. good work steven.
 
Thanks loads !!!!! :) That worked great .... just splitting whole thing out.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top