2012-01-30 77 views
0

我在如何总结Crystal Reports 8.01中的所有记录时遇到问题。我正在使用VB6。如何总结Crystal Reports 8.01中的所有记录

example: 
date    tools    in    out    
1/19/2012  stone    100    0 
1/20/2012  stone    50    0 
1/21/2012  stone    30    0 
1/25/2012  stone     0    40 
1/26/2012  stone     0    20 

total in until now : 180 
total out until now : 60 

我使用下面的代码在VB 6:

With CrystalReport1 
.SelectionFormula = "{stock.dates} >= #" & Format(DTPicker5.Value, "yyyy-mm-dd") & "#  and {stock.dates}<= #" & Format(DTPicker6.Value, "yyyy-mm-dd") & "#" 

End With 

在Crystal Reports,使用公式编辑器:

Sum ({stock.in}) ==> for total in 
Sum ({stock.out}) ==> for total out 

当运行日期2012年1月19日至1 /结果是:

total in until now : 180 
total out until now : 60 its true 

但是当我运行日期2012/1/20,直到2012年1月26日的结果是:

total in until now : 80 (the value is change) 
total out until now : 60 

如何使之选择日期时,不从一开始就改变,直到最后日期的价值?

+0

我努力了,但这个问题仍然没有多大意义。 – 2012-01-30 07:56:15

+0

可能他需要所有记录的总数,但只显示一些最后的记录。 – Arvo 2012-01-30 08:30:52

+0

是的,我需要所有记录的总数,但只显示一个 – 2012-02-09 04:09:32

回答

0

您至少有两种选择:

  1. 创建一些存储过程,能够计算总余额的任何日期和使用过程中的报告
  2. 不过滤基于最新记录(即不设置selectionformula),但是禁止显示旧记录;你需要使用一些参数来将这个日期转发到水晶物体(慢,但有时只有可能性)
相关问题