473,387 Members | 1,530 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

ASP page doesn't SUM amounts correctly

I'm fairly new to asp and am not sure why my web page doesn't sum the
amount from the access database correctly. Example, one teacher has 4
donations that should total $1,238.68, but the total on the page shows
only $838.68 (one of the $400 donation doesn't show). It happens
periodically to different teacher with no apparent pattern. Some
teachers total just fine. Thansk in advance!! Here's the section of
code:

Set rstSimple = cnnSimple.Execute("SELECT * FROM donations WHERE
(teachID ='" & teachID & "')")

Do While Not rstSimple.EOF
%>
<tr>
<td><%= rstSimple.Fields("orderdate").Value %></td>
<td><%= rstSimple.Fields("dateDonated").Value %></td>
<td><%= rstSimple.Fields("paymentType").Value %></td>
<td><%= rstSimple.Fields("donorFirstName").Value %>&nbsp;<%=
rstSimple.Fields("donorLastName").Value %></strong></td>
<td><%= rstSimple.Fields("donorAddress1").Value %><br><%=
rstSimple.Fields("donorAddress2").Value %></td>
<td><%= rstSimple.Fields("donorTown").Value %>,&nbsp; <%=
rstSimple.Fields("donorState").Value %>&nbsp;&nbsp;<%=
rstSimple.Fields("donorZip").Value %></td>
<td><%= rstSimple.Fields("donorPhone").Value %></td>
<td><%= rstSimple.Fields("email").Value %></td>
<td><%= rstSimple.Fields("amount").Value %></td>
<td><a href="Admin_add_cost.asp?Teacher=<%= teachID %>&id=<%=
rstSimple.Fields("id").Value %>">Delete</a></td>
</tr>
<%
rstSimple.MoveNext
Loop
rstSimple.Close
Set rstSimple = Nothing

'sum the donations for the teacher
Set rstSimple = cnnSimple.Execute("SELECT amount, SUM (amount) AS
total_donations FROM donations WHERE (teachID ='" & teachID & "') GROUP
BY amount")
total_donations = 0
Do While Not rstSimple.EOF
total_donations = total_donations + rstSimple.fields("amount")
rstSimple.MoveNext
Loop
%>

Nov 13 '05 #1
2 1173
I'd wager you'll get better answers about ASP if you asked in a newsgroup
devoted to ASP. The subject of this newsgroup is Microsoft Access database
software... ASP pages sometimes use a Jet (the default DB Engine that comes
with Access) database, but not Access itself.

Larry Linson
Microsoft Access MVP


Nov 13 '05 #2
Thanks, I'll hunt for the ASP newsgroup.

Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Kevin Lyons | last post by:
Hello, I am trying to get my select options (courses) passed correctly from the following URL: http://www.dslextreme.com/users/kevinlyons/selectBoxes.html I am having difficulty getting the...
31
by: Greg Scharlemann | last post by:
Given some recent success on a simple form validation (mainly due to the kind folks in this forum), I've tried to tackle something a bit more difficult. I'm pulling data down from a database and...
1
by: Holly | last post by:
Hi, I am using framework 1.0 to implement a printing method. The page margins I set won't show correctly on my print out. The code is: PageSettings pset=new PageSettings(); pset.Margins =new...
4
by: Peter Strøiman | last post by:
Hi. I have an ASP page that will receive a lot of post data ( sometimes many MB! ). The ASP page processes the data sequentially, but does not need the entire data stored in memory. ...
7
by: Brian Paul | last post by:
When a user clicks on a linkbutton on a page, i would like to render a printer-friendly version of the asp.net page and download it as an html attachment to the browser. The code below works great,...
4
by: Kevin Phifer | last post by:
Ok, before anyone freaks out, I have a solution I need to create that gathers content from maybe different places. Each one can return a <form> in the html, so its the classic can't have more than...
9
by: KenLee | last post by:
I made an application which includes classic asp page and asp.net page. when I tried to redirect from classic asp page to asp.net 2.0 page, it works under my local IIS directory. ex) <a...
3
by: mathewda | last post by:
I'm currently work'n on a project where I'm dynamically generating some HTML as text into a string builder. My ASP page has a <span> tag on it and after I gernerate HTML to my string builder I...
7
by: cartercc | last post by:
I think I already know the answer to this one, but I'm giving it the old college try. My problem is this: I have an HTML form that sends a bunch of data to a Perl script, where it is validated...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.