×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Record Duplication in Grid

Record Duplication in Grid

Record Duplication in Grid

(OP)
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

RE: Record Duplication in Grid

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

RE: Record Duplication in Grid

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 Smileing

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.

RE: Record Duplication in Grid

(OP)
Thanks for the reply!

Quote:

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

RE: Record Duplication in Grid

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.

RE: Record Duplication in Grid

(OP)
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 

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close