>>>F_DATE1=THISFORM.TEXT12.VALUE && {27/10/2004} >>>T_DATE1=THISFORM.TEXT11.VALUE && {23/02/2005} >>> >>> STORE 0 To Tb, Tl, Tw, Bw, Lw, W, Tfa, Fa, Ar >>> SELECT Flow_ra >>> ZAP >>> Fdate1 = F_date1 >>> DO While Fdate1>=F_date1 .and. Fdate1<=T_date1 >>> STORE 0 To B, L, W, W1, W2 >>> >>> SELECT Fixbook && reccount()=1007 >>> SUM For (Fix_date=Fdate1) .and. Mode='B' Fix_bag To B >>> SUM For (Fix_date=Fdate1) .and. Mode='L' Fix_bag To L >>> SUM For (Fix_date=Fdate1) Fix_kg To W >>> >>> SELECT Fixbill && reccount()=376 >>> SUM For (Date=Fdate1) Amount To Fa >>> R1 = Fa/(W/40) >>> Tfa = Tfa+Fa >>> Tb = Tb+B >>> Tl = Tl+L >>> Tw = Tw+W >>> >>> IF B>0 .or. L>0 .or. W>0 >>> SELECT Flow_ra >>> APPEND Blank >>> REPLACE Date With Fdate1, Bags With B, Lose With L, Total_bags With Tb, ; >>> Total_lose With Tl, Today With W, T_weight With Tw, Rate With R1, ; >>> Fix_a With Fa, Total_a With Tfa, Avr_rate With Tfa/(T_weight/40) >>> ENDIF >>> Fdate1 = Fdate1+1 >>> ENDDO >>>>>
*At least crucial at these 2 places >>DO While m.Fdate1>=m.F_date1 .and. m.Fdate1<=m.T_date1 >>*... >>Fdate1 = m.Fdate1+1 >>ENDDO >>Otherwise it's unclear if Fdate1, F_date1 and T_date1 are memory variables or fields of current alias. If anyone of them existed in current alias then field value takes precedence.
>>F_DATE1=Thisform.TEXT12.Value && {27/10/2004} >>T_DATE1=Thisform.TEXT11.Value && {23/02/2005} >> >>Select Flow_ra >>Zap >> >>Select fbk.Fix_Date,; >> sum(Iif(fbk.Mode='B',1,0)*fbk.Fix_Bag) As B, ; >> sum(Iif(fbk.Mode='L',1,0)*fbk.Fix_Bag) As L, ; >> sum(fbk.Fix_Kg) As W, ; >> sum(Nvl(fbl.Amount,0)) As Fa ; >> from FixBook fbk ; >> left Join FixBill fbl On fbk.Fix_Date = fbl.Date ; >> where Fix_Date Between m.F_DATE1 And m.T_DATE1 ; >> group By 1 ; >> into Cursor crsFix ; >> nofilter >> >>Store 0 To Tb, Tl, Tw, Tfa >> >>Scan For crsFix.B + crsFix.L + crsFix.W > 0 >> R1 = crsFix.Fa/(crsFix.W/40) && What if W is 0?-Data overflow possibility here >> Tfa = m.Tfa+crsFix.Fa >> Tb = m.Tb+crsFix.B >> Tl = m.Tl+crsFix.L >> Tw = m.Tw+crsFix.W >> >> Insert Into Flow_ra ; >> (Date, Bags, Lose, Total_bags, ; >> Total_lose, Today, T_weight, Rate, ; >> Fix_a, Total_a, Avr_rate) ; >> values ; >> (crsFix.Fix_Date, crsFix.B, crsFix.L, m.Tb, ; >> m.Tl, crsFix.W, m.Tw, m.R1, ; >> crsFix.Fa, m.Tfa, m.Tfa/(m.Tw/40)) >>Endscan >>>>PS: Also make sure textbox values are date and not datetime. If they're datetime your code was incrementing second not day. This is safer: