Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Record Duplication in Grid

Status
Not open for further replies.

alisaif

ISP
Apr 6, 2013
418
AE
Hi,

I am facing a very strange problem since long time.
Though it is not common, means it is not showing all the time. Sometime it is showing duplicate record.
Please go through the image. The upper one is grid in which the record is duplicate. And, down the table
in which normal record is showing.

Please let me how can I check it.

In other word, it is strange problem but a very dangerous problem.

Please help...

Thanks

Saif
duprec_e92npp.png
 
Is your Grid displaying ONLY the records of your original 'primary' table?

Or is the Grid displaying the records from a SQL Query where the 'primary' table is combined in some manner with one or more other 'secondary' tables?

If the later, look in your 'secondary' tables for duplicate records which could be causing the SQL Query's result to contain duplicate records.

Good Luck
JRB-Bldr
 
I am wondering if the values in your grid are not properly bound to the underlying table?

Alternatively, is it possible that there is a corrupt index?

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.
 
Thanks for the reply!

If the later, look in your 'secondary' tables for duplicate records which could be causing the SQL Query's result to contain duplicate records.

No, I don't think so, because it display proper records in grid, if we quit from the program and load it again.

Please suggest

Saif
 
What is the grid's RecordSource?

If you don't specify, it will use whatever alias is currently selected which may not be what you expect.
 
Thanks for the reply!

Please find below the code which generates the ledger:

Code:
Local nbal
If ! Empty(This.parent.contAccount.mActCode.Value)
   This.Parent.cmdprint.Enabled = .T.
   dt1        = This.Parent.contperiod1.datefromto1._datepicker1.Value
   dt2        = This.Parent.contperiod1.datefromto1._datepicker2.Value
   mpcode     = This.parent.contAccount.mActCode.Value
   mfull_name = This.parent.contAccount.mFull_name.Value

   Select cReference,cdate,remarks,debit,credit,Cast ( 0 As numeric(15,2)) As balance,;
      SPACE(2) As drcr,ccode From actran Where Between(cdate,dt1,dt2) And ccode = mpcode ;
      Into Cursor tempec Readwrite nofilter
   Index On Dtoc(cdate,1)+ccode Tag cdate
   Select actran
   Sum debit-credit To opbal For cdate<dt1 And ccode = mpcode
   nbal = 0.00
   Select tempec
   Set Order To cdate
   Append Blank
   Replace cdate With dt1,remarks With 'Opening Balance'
   If opbal > 0
      Replace debit With opbal
   Else
      Replace credit With -(opbal)
   Endif
   Go Top
   Scan
      nbal = nbal + debit - credit
      Replace balance With nbal In tempec
      Replace drcr With Iif(balance>0,'DR','CR')
   Endscan

   Sum debit,credit To mtotdr,mtotcr
   mtotbal = mtotdr-mtotcr
   Sum debit,credit To mnetdr,mnetcr For ! Empty(cReference)
   mnetbal = mnetdr-mnetcr

   This.Parent.contmaincat.totalcontainer.totdr.Value  = mtotdr
   This.Parent.contmaincat.totalcontainer.totcr.Value  = mtotcr
   This.Parent.contmaincat.totalcontainer.totbal.Value = mtotbal
   This.Parent.contmaincat.totalcontainer.netbal.Value = mnetbal
   Do Case
      Case mnetbal > 0
         This.Parent.contmaincat.totalcontainer.netbal.ForeColor = Rgb(0,0,255)
      Case mnetbal < 0
         This.Parent.contmaincat.totalcontainer.netbal.ForeColor = Rgb(255,0,0)
      Case mnetbal = 0
         This.Parent.contmaincat.totalcontainer.netbal.ForeColor = Rgb(0,0,0)
   Endcase
   Do Case
      Case mtotbal > 0
         This.Parent.contmaincat.totalcontainer.lbldrcr.Caption = 'Dr'
      Case mtotbal < 0
         This.Parent.contmaincat.totalcontainer.lbldrcr.Caption = 'Cr'
   Endcase
   Go Top

   This.Parent.contmaincat.Enabled = .T.
   This.Parent.contperiod1.Enabled = .F.
   This.Enabled = .F.

   Select tempec
   Go Top
   With This.Parent.contmaincat.grid1
      .RecordSource = 'Tempec'
      .RecordSourceType = 1
      .column1.ControlSource = "Tempec.cReference"
      .column2.ControlSource = "Tempec.cdate"
      .column3.ControlSource = "Tempec.remarks"
      .column4.ControlSource = "Tempec.debit"
      .column5.ControlSource = "Tempec.credit"
      .column6.ControlSource = "Tempec.balance"
      .column7.ControlSource = "Tempec.drcr"
   Endwith
Else
   Messagebox("Please Select Accounts Code Before Proceed",16)
   This.parent.contAccount.mActCode.SetFocus
ENDIF
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top