Results 1 to 2 of 2
  1. #1
    revolution9540 is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jul 2015
    Posts
    18

    Question How to eliminate repeated query results in Microsoft Access with One-to-Many relationships

    A similar question has recently been asked on this thread. However, I want to know if there is a way to get around it. I am using Microsoft Access 2013 to create a database of computer equipment that our users have at my workplace. I have a query that searches by their user name and outputs their equipment. However, when the user has more than one type of equipment in one table, the results from previous tables repeat themselves to compensate for this extra piece of equipment.
    I am wondering if there is a way to get around this, where the additional rows due to multiple items of the same type are blank for fields that already have a value in the first row. Here is the layout of my database so far:

    Table: Users

    • Username
    • Last Name
    • First Name

    Table: Desktops

    • Model Number
    • Serial Number



    Table: Mobile Devices

    • Model Number
    • Serial Number

    So, for example, if person with the username jdoe has one desktop, and one mobile device, the query will output all of his equipment in one row as desired. However, if jdoe gets a second laptop, the query will have all the equipment and his first laptop in row one and the same equipment and his second laptop in row two.
    I understand why Access does this, I am just wondering if there is a way to get around this. Here is the SQL code:

    Code:
    SELECT Desktops.[Brand/Type/Model Number], Printers.[Brand/Type/Model Number], [Mobile Devices].[Brand/Type/Model Number], [Docking Stations].[Brand/Type/Model Number], [Home Use].[Brand/Type/Model Number], Miscellaneous.[Brand/Type/Model Number]
    FROM ((((((Users LEFT JOIN Desktops ON Users.Username = Desktops.Owner) LEFT JOIN [Docking Stations] ON Users.Username = [Docking Stations].Owner) LEFT JOIN [Home Use] ON Users.Username = [Home Use].Owner) LEFT JOIN Miscellaneous ON Users.Username = Miscellaneous.Owner) LEFT JOIN [Mobile Devices] ON Users.Username = [Mobile Devices].Owner) LEFT JOIN Printers ON Users.Username = Printers.Owner) LEFT JOIN [Virtual Machines] ON Users.Username = [Virtual Machines].Owner
    WHERE (((Users.Username)=[Enter Username]));
    Any thoughts? Thanks so much.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Build report and set textbox HideDuplicates property to yes.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Query Criteria for repeated Item
    By rashock in forum Access
    Replies: 3
    Last Post: 01-28-2014, 07:38 PM
  2. Replies: 5
    Last Post: 05-21-2013, 02:21 PM
  3. Eliminate Duplicate (mirrored) Results
    By fauowls in forum Access
    Replies: 3
    Last Post: 03-21-2013, 03:39 PM
  4. Looking for code to eliminate Nul results
    By Jamescdawson in forum Queries
    Replies: 6
    Last Post: 02-25-2012, 03:42 AM
  5. Replies: 1
    Last Post: 09-13-2011, 01:52 PM

Tags for this Thread

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