Looping Records from Database in HTML Email Notification ASP page

The following piece of code is the only part I can't get to work in my shopping cart email notification. I am trying to pull the items in the cart table of an Access database and submit it in the email with HTML format.

Can anyone see what I am missing here?
Any help will be greatly apreciated.
You may need to copy the code and paste in an editor to see the format.


HTML = HTML &"<tr bordercolor=""#C9C0AB"" bgcolor=""#FFFFFF"">"
HTML = HTML &"<td><div align=""center"">"& cRS("Ctquantity") & "</div></td><td><div align=""center"">" & cRS("Ctsize") & "</div></td><td><div align=""center"">"& cRS("Ctcolor") &"</div></td><td><div align=""center"">"& cRS("Ctembroideropt")&"</div></td><td><div align=""center"">"& cRS("Ctproductname") &"</div></td><td><div align=""right"">"& cRS("Ctproductprice") &"</div></td><td><div align=""right"">"& lineTotal & vbCrLf &"</div></td>"
HTML = HTML &"</tr>"

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

sometimes it might be usefull to do


before any access to .eof or .recordcount.
this might look strange, but i collided once with the circumstance that .recordcount was 0 in my app when the recordset was opened, and so .eof was true, i think i remember, althought there were records in the set. with this sniplet i got it to work.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Well since i dont have the rS at my place i substuted it with text. the asp code has no error. can you plese tell me what error you are facing?

You can try:

Do until  cRS.EOF

If that work you ADO stuff is allright.

Change the string HTML to sHTML

And change " to '  like this
HTML = HTML &"<td><div align=""center"">"& cRS("Ctquantity") & "</div></td><td><div align=""center"">" & cRS("Ctsize")
to this:
sHTML = sHTML & "<td><div align='center'>" & cRS("Ctquantity").value & "</div></td><td><div align='center'>" & cRS("Ctsize").value

Also note that some places you have  (&") without spaces put in a space as needed  (& ").

If it still dont work you might have the name on one of your columns misspellt.
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

besides this if the property value doesnt have a space you can ignore the quotes. quotes are needed when the property value has spaces.
one more thing is then you dont need div tag you can specify the alignment in the td tag

pls check for NULL values in the result set. one of the fields must be returning a null value.
This Question is getting old, can you please clean it up.

Regards SNilsson
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.