Results 1 to 3 of 3
  1. #1
    aamer is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Jul 2010
    Location
    Pakistan
    Posts
    276

    Duplicate Transaction Fix Help Needed

    I am unable to point out the problem that the transaction is being duplicated when a file is attached.
    Following is the SQL Query

    SELECT Pchase.PurCompanyName, Pchase.PurTransId, Pchase.[Purchase Date], Pchase.[Purchase Description], Pchase.[Party Challan #], Pchase.[Invoice #], Pchase.[Purchase Qty], Pchase.[Purchase Price], Pchase.[Purchase Units], Company.CoId, Pchase.[Pur Seller], ([Payment Made]+[Mobile Deduction]) AS Dbt, Pchase.[Amount Returned], [Purchase Remarks] & " " & [Stored At] & " " & [D2Party] & " " & [SB] & " " & [PPMTTYP] & " " & [TrNo] & " " & [Cheque PO #] & " " & [Podtd] & " " & [Ref] AS Rem, IIf([Amount Returned]=0,([Purqty]*[Purchase Price]+[GST Amount]),[Amount Returned]) AS PurCredit, Pchase.[Pur Varification], Pchase.[Cheque PO #], [Purchase Description] & " " & [Salery Month] AS Des, IIf([Supplier Bank]="Nil",Null,[Supplier Bank]) AS SB, IIf([Payment Type]="Nil",Null,[Payment Type]) AS PPMTTYP, IIf([Delivered To Party]="Nil",Null,[Delivered To Party]) AS D2Party, Pchase.purattach, Pchase.[Mobile Deduction], Pchase.[Payment Made], IIf(IsNull([purattach].[FileData])," ","Yes") AS Patt, Company.[NIC No], Voucher.VoucherNo, [Party Challan #] & " " & [VoucherNo] AS GPVOU, IIf([Truck #]="Nil"," ",[Truck #]) AS TrNo, Company.CoAttach, Company.NICcopyFront, Company.NICcopyBack, Pchase.[GST Rate], Pchase.[GST Amount], Pchase.[Total Amount], Pchase.GSTR, Pchase.Purqty, Pchase.[Purchase Cash Qty], Pchase.[Purchase Sales Tax], IIf(IsNull([purattach].[FileData])," ","@") AS ACatt, [Purchase Remarks] & " " & [Ref] AS ACattRem, Company.Mobile, Pchase.PurDate, IIf([Cheque PO #]>0,[Chq PO Date]," ") AS Podtd, Pchase.[EntryPLogin By], IIf([EntryPLogin By]="Aamer Sheikh","AAS",[EntryPLogin By]) AS TransBy, Pchase.[SupervisePLogin By], Company.ComapnyName, Company.EmployeeWorkLoc, Pchase.[Delivered To Party]


    FROM (Company INNER JOIN Pchase ON Company.ComapnyName = Pchase.PurCompanyName) LEFT JOIN Voucher ON Pchase.PurTransId = Voucher.[Vou ID]
    ORDER BY Pchase.PurTransId, Pchase.[Purchase Date];

    Click image for larger version. 

Name:	trans.jpg 
Views:	13 
Size:	68.8 KB 
ID:	27324



    Kindly guide me how to fix the duplication of transaction.

    Thanks

  2. #2
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    I don'e see how that SQL relates to the screen image - the SQL has far more fields than that diagram does, and what do purchases have to do with salary?

    But for the duplication - it's because either:
    a) PChase has more than one record for the same company i.e. there is more than once case where Company.ComapnyName = Pchase.PurCompanyName
    or
    b) Voucher has more than one record for the same Pchase, i.e. there is more than one case where Pchase.PurTransId = Voucher.[Vou ID]


    Since your diagram does not include any of those fields, I can't tell which of those might be the case.

    Buy why would one company NOT have more than one purchase? It makes sense it would.

  3. #3
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,830
    if you just want to eliminate duplicates and the query is not required to be updatable use

    SELECT DISTINCT Pchase.PurCompanyName....

    However from what you have shown, the records are not duplicates - the balance column has different values

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 7
    Last Post: 02-10-2016, 10:00 AM
  2. transaction report
    By deepucec9 in forum Reports
    Replies: 1
    Last Post: 11-12-2015, 10:27 AM
  3. Help needed : Library catalogue in access format is needed
    By dealers in forum Sample Databases
    Replies: 3
    Last Post: 01-16-2014, 02:03 PM
  4. Transaction Log
    By gtimmies in forum Database Design
    Replies: 1
    Last Post: 05-27-2013, 03:27 PM
  5. Replies: 7
    Last Post: 11-14-2011, 05:59 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums