Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old April 23rd, 2005, 10:31 AM
kila kila is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 90 kila User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 14 h 33 m 59 sec
Reputation Power: 5
Looping items for email BCC

I have a storefront order notification routine, and it includes a CDO email function to send an email alert to my customers.

I want to add each manufacturer email (ManufName) in the BCC section, so they get notified of the order as well. Problem is, each Order number (OrderID) can have several purchased items associated with it (i.e. a customer buys several different products from different manufacturers), so I have to do a DO UNTIL loop. I am stuck however..

Again, the common identifying column is the OrderID. If there are several different files in a purchase, there will be several rows with the same OrderID.

Here is what I have made so far. Somehow this has to be turned into an array, so it can be put in the BCC field? Thanks for any help offered!
Code:
 
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open "SELECT * FROM qOrders WHERE OrderID = "&OrderIDFG&";", cnDZ, adOpenStatic, adLockOptimistic
CurrentItem = rs("OrderID")
Do Until CurrentItem <> rs("OrderID")
rs.MoveNext 
If rs.EOF Then Exit Do
Loop
rs.MovePrevious
Response.Write"" & rs("ManufName") & "" 
rs.MoveNext
Loop
rs.Close
Set rs = Nothing



This is what the end result should look like, if the order had products from 3 different manufacturers:
Code:
 
'Begin Send an Email to Customer and Store admin to notify them of their purchase and download instructions
	 Set cMailer = Server.CreateObject("CDO.Message")
cMailer.From = admin@mystore.com
cMailer.To = Payer_Email
cMailer.Bcc = bob@manufacturer1.com, sue@manufacturer5.com, bill@manufacturer15.com 

Reply With Quote
  #2  
Old April 24th, 2005, 10:41 AM
Doug G Doug G is offline
Grumpier Old Moderator
ASP Free God 11th Plane (10000 - 10499 posts)
 
Join Date: Sep 2003
Posts: 10,143 Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 3 Weeks 4 Days 21 h 28 m 48 sec
Reputation Power: 180
Does the response.write show you the right data? If so you can simply add the field to a string in each iteration through your loop.

Response.Write"" & rs("ManufName") & ""
strStuff = strStuff & rs("ManufName") & ","
__________________
======
Doug G
======
I didn't attend the funeral, but I sent a nice letter saying I approved of it. --Mark Twain

Reply With Quote
  #3  
Old April 24th, 2005, 10:49 AM
kila kila is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 90 kila User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 14 h 33 m 59 sec
Reputation Power: 5
Ok, that sounds like it would work.

20,000 dollar question: If someone buys, lets say, 4 products from one manufacturer in one order, I would only like to have the system send one email to that manufacturer. Any idea how to easily accomplish that?

Thanks



Quote:
Originally Posted by Doug G
Does the response.write show you the right data? If so you can simply add the field to a string in each iteration through your loop.

Response.Write"" & rs("ManufName") & ""
strStuff = strStuff & rs("ManufName") & ","

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingVisual Basic Programming > Looping items for email BCC


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway