Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Iron Speed
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:
Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
  #1  
Old November 14th, 2003, 10:52 AM
peachsoda03 peachsoda03 is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 10 peachsoda03 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Loop statement help

Hello,

I am having trouble creating a loop statement for an email I am trying to generate after the database is updated. I would like the email to list each item for a particular form. Right now it is only listing the first item of each form when the email is sent. Any ideas? Here is the email code:

if (debug = True) then
body = vbNewLine & "NOTE: THIS SYSTEM IS CURRENTLY IN DEBUG MODE AND ANY REPORTS YOU RECEIVE MAY BE FALSE" & vbNewLine & vbNewLine
end if

body = body & "---------------------" & vbTab & vbTab & vbTab & vbTab & vbTab & vbTab & "------" & vbNewLine & vbNewLine
body = body & "EACR Form Submission:" & vbTab & vbTab & vbTab & vbTab & vbTab & vbTab & "Items:" & vbNewLine & vbNewLine
body = body & "---------------------" & vbTab & vbTab & vbTab & vbTab & vbTab & vbTab & "------" & vbNewLine & vbNewLine & vbNewLine

esql = "SELECT * FROM Eacr WHERE ID = " & Request.Form("eacrID")
rs6.open esql, conn, adOpenstatic, adLockReadOnly, adCmdText

asql = "SELECT * FROM User WHERE ID = " & Rs6("UserID")
rs.open asql, conn, adOpenstatic, adLockReadOnly, adCmdText

body = body & "Submitted By: " & Rs("FirstName") & " " & Rs("LastName") & vbTab & vbTab & vbTab & vbTab & "Lot #: " & eacrID & vbNewLine
body = body & "Date Submitted: " & today & vbTab & vbTab & vbTab & vbTab & vbTab & "Item " & i & ":" & vbNewLine & vbNewLine

asql = "SELECT * FROM ItemDetails WHERE EACRID = " & Request.Form("eacrID")
rs.open asql, conn, adOpenstatic, adLockReadOnly, adCmdText

bsql = "SELECT Description FROM Disposition WHERE ID = " & Rs6("DispositionID")
rs2.open bsql, conn, adOpenstatic, adLockReadOnly, adCmdText

body = body & "Lot #: " & eacrID & vbTab & vbTab & vbTab & vbTab & vbTab & vbTab & " Serial: " & Rs("SerialNumber") & vbNewLine
body = body & "Disposition Type: " & Rs2(0) & vbTab & vbTab & vbTab & " Decal #: " & Rs("Decal") & vbNewLine

bsql = "SELECT * FROM Department WHERE ID = " & Rs6("DepartmentID")
rs2.open bsql, conn, adOpenDynamic, adLockReadOnly, adCmdText

csql = "SELECT * FROM Reason"
rs3.open csql, conn, adOpenstatic, adLockReadOnly, adCmdText

dsql = "SELECT * FROM Condition"
rs4.open dsql, conn, adOpenstatic, adLockReadOnly, adCmdText

body = body & "Requisition Number: " & Rs6("ReqNumber") & vbTab & vbTab & vbTab & vbTab & vbTab & vbTab & " Description: " & Rs("Description") & vbNewLine
body = body & "Recipient: " & Rs6("Recipient") & vbTab & vbTab & vbTab & vbTab & vbTab & vbTab & " Manufacturer: " & Rs("Manufacturer") & vbNewLine
body = body & "Erase Hard Drives: " & Rs6("HDDCheck") & vbTab & vbTab & vbTab & vbTab & vbTab & " Model: " & Rs("Model") & vbNewLine
body = body & "Department Name: " & Rs2("Name") & vbTab & vbTab & vbTab & vbTab & " Building: " & Rs("Building") & vbNewLine
body = body & "Department Number: " & Rs2("Number") & vbTab & vbTab & vbTab & vbTab & vbTab & " Room: " & Rs("Room") & vbNewLine

body = body & "Department Phone: " & Rs2("Telephone") & vbTab & vbTab & vbTab & vbTab & vbTab & " Reason Code: " & Rs3("Description") & vbNewLine
body = body & " " & vbTab & vbTab & vbTab & vbTab & vbTab & " Condition Code: " & Rs4("Description") & vbNewLine
body = body & " " & vbTab & vbTab & vbTab & vbTab & vbTab & " Funding: " & Rs("Funding") & vbNewLine
body = body & " " & vbTab & vbTab & vbTab & vbTab & vbTab & " Value: " & Rs("Value") & vbNewLine & vbNewLine

Rs4.close
Rs3.close
Rs2.close
Rs.close
Rs6.close

Last edited by peachsoda03 : November 14th, 2003 at 11:12 AM.

Reply With Quote
  #2  
Old November 15th, 2003, 04:45 AM
Monkey's Avatar
Monkey Monkey is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Location: Germany (currently)
Posts: 83 Monkey User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
I have experienced similar problems with email in the past, the only positive solution I have come up with is to set your variables from the database before writing the values directly to your email code.

So an example would be.
Code:
Dim tmpReqNum as Integer

tmpReqNum = Rs6("ReqNumber")

body = body & "Requisition Number: " & tmpReqNum & ......


Allthough saying that I have also had issues like this because I kept overwriting my body with the new version, so to get around that I created a new body variable which would build the entire body.

Example below is not directly relevant to you because the email body resides in Html within a database then it gets called and it checks for predefined areas of the email which contain a specific string to point out to the code that a correspionding item needs to be replaced there.

Code:
					If Not IsNull(fldPrefix) Then
						NewobjMailContent = replace(objMailContent, "[prefix]", NewPrefix)
					End If
					If Not IsNull(fldLname) Then
						NewobjMailContent = replace(NewobjMailContent, "[fname]", NewLname)
					End If


I hope this helps you in some way.

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingVisual Basic Programming > Loop statement help


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

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five "checkpoints" for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

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

Iron Speed




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