&&at save command button.. SELE typ2 LOCATE FOR txtname=UPPER(ALLTRIM(thisform.txtname.value)) IF !FOUND() append from dbf('crsDist') ELSE MESSAGEBOX("Exist") endif With Thisform .grdDistribution.RecordSource = '' .grdDistribution.Visible = .T. endwiththanks.
>SELE crsDist >SELE MyTable >APPEND FROM crsDist >>
>>>> Create Cursor crsDist (From d, To d, Amount Y,txtName C(19),txtPrincipal Y) >>>> For ix=0 To .txtMonths.Value >>>> ldCurrent = Gomonth(.txtStart.Value,m.ix) >>>> ldFrom = Iif(m.ix = 0, m.ldCurrent, ; >>>> Date( Year(m.ldCurrent), Month(m.ldCurrent), 1)) >>>> ldTo = Iif(m.ix = .txtMonths.Value, m.ldCurrent,; >>>> Gomonth(m.ldCurrent,1)-Day(Gomonth(m.ldCurrent,1))) >>>> Do Case >>>> Case m.ix = 0 >>>> lnAmount = m.lnPayment * ((Day(m.ldTo)-Day(m.ldCurrent))/30) >>>> Case m.ix = .txtMonths.Value >>>> lnAmount = m.lnPayment * ((Day(m.ldCurrent)-1)/30) >>>> Otherwise >>>> lnAmount = m.lnPayment >>>> >>>> ENDCASE >>>> M.ASD=THISFORM.TXTNAME.VALUE >>>> M.txtPrincipal=THISFORM.txtPrincipal.VALUE >>>> Insert Into crsDist (From,To,Amount,txtNAME,txtPrincipal) ; >>>> values ; >>>> ( m.ldFrom, m.ldTo,m.lnAmount,M.ASD,M.txtPrincipal) >>>> Endfor >>>> Locate >>>> .grdDistribution.RecordSource = 'crsDist' >>>> .grdDistribution.Visible = .T. >>>> >>>>>>>>thanks
>>>>>>>use mytable in 0 >>>>>>>SELE MyTable >>>>>>>locate for .... >>>>>>>if !found() >>>>>>> Append from grdDistribution >>>>>>>endif >>>>>>>>>>>>>>
>>>>>>>>use mytable in 0 >>>>>>>>locate for .... >>>>>>>> if !found() >>>>>>>>*Append from dbf('grdDistribution') && rong >>>>>>>>*Append from DBF(grdDistribution.RecordSource = 'crsDist')&&rong >>>>>>>>*append from cursor ('crsDist')&&rong >>>>>>>>*append from (crsDist.cursor)&&rong >>>>>>>>else >>>>>>>>. >>>>>>>>. >>>>>>>> endif >>>>>>>>>>>>>>>>thanks.