Results 1 to 3 of 3
  1. #1
    zbaker is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2014
    Posts
    18

    Angry Query will not show distinct lines

    Doesnt anyone have an idea why my query shows distinct on some records but not on others.



    SELECT DISTINCT tblMASTERDeviceTable.AccrualRefID, tblMASTERSiteListTable.CC, tblMASTERSiteListTable.CCDescr, tblMASTERSiteListTable.Region, tblMASTERSiteListTable.CompanyCode, tblMASTERSiteListTable.CompanyName, tblMASTERContractTable.TVCNo, tblMASTERContractTable.ServiceAgreementVendorName, tblMASTERDeviceTable.EquipID, tblMASTERDeviceTable.CEIDNumber, tblMASTERDeviceTable.SerialNumber, tblMASTERDeviceTable.InvoiceRefNo, tblMASTERDeviceTable.Modality, tblMASTERDeviceTable.DeviceManufacturer, tblMASTERDeviceTable.DeviceModel, tblMASTERDeviceTable.DeviceDescription, tblMASTERDeviceTable.[Device Annual Contract Amount], tblMASTERDeviceTable.[Device Contract Start Date], tblMASTERDeviceTable.[Device Contract End Date], tblMASTERDeviceTable.DeviceDeactivated, tblMASTERDeviceTable.DeviceDeactivationDate, tblMASTERDeviceTable.DeviceDeactivationReason, tblMASTERDeviceTable.DateDataChanged, tblMASTERDeviceTable.Notes, IIf([Device Contract Start Date]<=Now() And [Device Contract End Date]>=Now() And [DeviceDeactivated]=False,"Active",IIf([Device Contract Start Date]>Now() Or [Device Contract End Date]<Now() Or [DeviceDeactivated]=True,"Inactive","Error")) AS [Contract Status], [Accrual Subquery].[Outstanding Balance]
    FROM tblMASTERSiteListTable INNER JOIN (tblMASTERContractTable INNER JOIN (tblMASTERDeviceTable INNER JOIN [Accrual Subquery] ON tblMASTERDeviceTable.AccrualRefID = [Accrual Subquery].AccrualRefID) ON tblMASTERContractTable.TVCNo = tblMASTERDeviceTable.TVCNo) ON tblMASTERSiteListTable.CC = tblMASTERDeviceTable.CostCenter
    WHERE (((IIf([Device Contract Start Date]<=Now() And [Device Contract End Date]>=Now() And [DeviceDeactivated]=False,"Active",IIf([Device Contract Start Date]>Now() Or [Device Contract End Date]<Now() Or [DeviceDeactivated]=True,"Inactive","Error")))="Active")) OR ((([Accrual Subquery].[Outstanding Balance])<>0))
    ORDER BY tblMASTERDeviceTable.AccrualRefID;

  2. #2
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    What do you mean by "...distinct on some records but not on others..." - do you mean some look to be duplicates?

    You are selecting a lot of fields to be using the "Distinct" qualifier.

    Can you give more detail on the problem you are having.

  3. #3
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,722
    ???? You could try DISTINCTROW instead of DISTINCT, but I'm really not sure what you are asking.

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

Similar Threads

  1. show record lines when printing report?
    By joe55555 in forum Reports
    Replies: 4
    Last Post: 11-21-2013, 05:13 AM
  2. Removing lines from a query
    By Big D in forum Queries
    Replies: 1
    Last Post: 08-07-2013, 07:54 AM
  3. Distinct query?
    By Kivan in forum Queries
    Replies: 3
    Last Post: 08-29-2012, 10:16 PM
  4. distinct query
    By slimjen in forum Queries
    Replies: 4
    Last Post: 05-25-2012, 08:30 AM
  5. distinct query
    By slimjen in forum Queries
    Replies: 3
    Last Post: 02-04-2012, 04:44 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