计算一个字段的总和! [英] Calculate sum of a field!

查看:82
本文介绍了计算一个字段的总和!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的所有人

实际上,我正在通过选择DATE来打印报告,并且正在为该日期的所有记录打印报告。

现在我有了一个字段我的表格中的比率,我想根据标准(在该日期)计算该RATE字段的总和。

使用以下代码打印我的报告没有任何问题: -

Dear all
Actually i am printing a report by selecting a DATE and the report is being printed for all the records on that DATE.
Now i have a field RATE in my table and i want to calculate the sum of that RATE field based on the criteria (on that date).
My report is being printed without any problem using the below code:-

rs.Open "select * from patients where Receipt_date=#" & Label3.Caption & "#", Con, adOpenDynamic, adLockPessimistic
       Set DataReport1.DataSource = rs
       DataReport1.Show



但我想基于的计算该RATE字段的总和标准(在该日期)



i希望将总金额放在数据集市上。







谢谢


but i want to calculate the sum of that RATE field based on the criteria (on that date)

i want to put the total sum on a datareport.



Thank you

推荐答案

Dim x As Integer

Do not not rs .EOF



x = x + rs.Fields(6).Value



rs.MoveNext Loop < br $>


DataReport1.Sections(Section5)。Controls(label17)。C aption = x Set DataReport1.DataSource = rs DataReport1.Show
Dim x As Integer
Do While Not rs.EOF

x = x + rs.Fields(6).Value

rs.MoveNext Loop

DataReport1.Sections("Section5").Controls("label17").C aption = x Set DataReport1.DataSource = rs DataReport1.Show


亲爱的所有

我找到了问题的解决方案:



Dear all
I have found the solution to the problem:

Dim x As Integer
Do While Not rs.EOF

  x = x + rs.Fields(6).Value

  rs.MoveNext
Loop

   DataReport1.Sections("Section5").Controls("label17").Caption = x
        Set DataReport1.DataSource = rs
        DataReport1.Show





它解决了这个问题。

Sarfaraz



It solved the problem.
Sarfaraz


这篇关于计算一个字段的总和!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆