mrmazur
03-08-2006, 04:35 PM
Hello, I have a simple order entry application that creates quotes/orders and the dilema I'm having is with a Do While statement (I believe). In my quotes table one quote may have a number of records (one record per item ordered/quoted). I have no problems displaying all the quotes/orders with all the lines showing. However I only want one quote per line to display. Here is my code that I'm trying to accomplish this with but I get an Exception Occured error on the line where I'm trying to interject the nested Do Loop. Below is the code. Any and all help with this would be greatly appreciated.
Dim Customer
Dim CurrentQuote
Do While not rsQuotes.EOF
Customer = rsQuotes("cID")
CurrentQuote = rsQuotes("qID")
custSQL = "SELECT company, phone FROM tblCustomers WHERE cID=" & Customer
rsCustomer.Open custSQL, adoCon
%>
<tr>
<td><a href="view_quotes.asp?cID=<% =rsQuotes("qID") %>"><% =rsQuotes("qID") %></a></td>
<td><% =rsQuotes("Timestamp") %></td>
<td><% =rsCustomer("company") %></td>
<td><div align="center"><a href="quote_details.asp?qID=<% =rsQuotes("cID") %>">View Details</a></div></td>
</tr>
<% 'Move to the next record in the recordset
Do While CurrentQuote = rsQuotes("qID")
rsQuotes.MoveNext
Loop
rsCustomer.Close
Loop
Dim Customer
Dim CurrentQuote
Do While not rsQuotes.EOF
Customer = rsQuotes("cID")
CurrentQuote = rsQuotes("qID")
custSQL = "SELECT company, phone FROM tblCustomers WHERE cID=" & Customer
rsCustomer.Open custSQL, adoCon
%>
<tr>
<td><a href="view_quotes.asp?cID=<% =rsQuotes("qID") %>"><% =rsQuotes("qID") %></a></td>
<td><% =rsQuotes("Timestamp") %></td>
<td><% =rsCustomer("company") %></td>
<td><div align="center"><a href="quote_details.asp?qID=<% =rsQuotes("cID") %>">View Details</a></div></td>
</tr>
<% 'Move to the next record in the recordset
Do While CurrentQuote = rsQuotes("qID")
rsQuotes.MoveNext
Loop
rsCustomer.Close
Loop