2012-01-30 75 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),但是禁止顯示舊記錄;你需要使用一些參數來將這個日期轉發到水晶物體(慢,但有時只有可能性)
相關問題