Results 1 to 6 of 6
  1. #1
    rkbisme is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Oct 2014
    Posts
    3

    Rusty access query


    Ok, well I've been trying to help someone else, once upon a time I use to be working with access a lot, but years have past so I'm rusty or just old. So here is the issue..seems simple. I have two tables that have a relationship...now the query is basic..I just need to get all the records from both table put into a single line...so what I have is partnumber and attribute in one table and part number and attribute in another table. so I just want to see one partnumber and both attribute numbers.

    it would look like partnumber attribute
    .................................xyz....... 10
    ............................................. .15

    and so on.

    I don't know why my mind isn't working but I've lost my logic hat. any help would be great. thanks in advance.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    Start a query design, add both tables,
    link the 2 tables by grabbing a field from 1 table and drop it on top of the matching field in the 2nd table (the join)
    bring down your fields to the grid you want to see
    run

  3. #3
    rkbisme is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Oct 2014
    Posts
    3
    Quote Originally Posted by ranman256 View Post
    Start a query design, add both tables,
    link the 2 tables by grabbing a field from 1 table and drop it on top of the matching field in the 2nd table (the join)
    bring down your fields to the grid you want to see
    run
    ..lol I'm not that rusty...ha. the query does what it should, however I need the data to either go into excel and only list the part number once in one column but all the attributes into a single column with as many rows that there are attributes.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Exporting a table or query cannot suppress repetition. Try building a report using Grouping & Sorting features and export the report. Report in Print Preview, right click > Export > Excel.
    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.

  5. #5
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    I have two tables that have a relationship...now the query is basic..I just need to get all the records from both table put into a single line
    If you want to have the "PartNumber" and the "Attribute" fields from both tables in a single line, you would add the "PartNumber" and the "Attribute" fields from both tables.
    It would look like
    Code:
      partnumber   attribute    partnumber     attribute
    .....xyz........... 10..........xyz........... 15

    If you want to have one "PartNumber" and one "Attribute" from BOTH tables, you would need to use a Union query.
    It would look like
    Code:
     partnumber     attribute
    ......abc.......... 13  (From Table1)
    ......abc......... .16  (From Table2)
    ......xyz.......... 10  (From Table1)
    ......xyz......... .15  (From Table2)
    Then use a report for grouping.

    Or you could use the (sorted) union query as the source and use VBA create a CSV file which could then be imported into Excel in your format.
    Loop through the query, writing the first line with the "PartNumber" and "Attribute", then a line with only the "Attribute" until the "PartNumber" changes.

  6. #6
    rkbisme is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Oct 2014
    Posts
    3
    Great thanks everyone...I had thoughts in my head that I had to use a report to handle this, just after a 3 year hiatus I've forgotten a lot more than I care to admit and not being sure of yourself means a whole lot of second guessing..thanks for the bailout.

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

Similar Threads

  1. Rusty DBA needs some help :)
    By aggiekim in forum Queries
    Replies: 3
    Last Post: 09-11-2014, 07:13 PM
  2. Replies: 0
    Last Post: 08-20-2013, 09:05 AM
  3. Replies: 3
    Last Post: 04-24-2012, 08:32 AM
  4. Replies: 2
    Last Post: 01-23-2012, 11:15 AM
  5. Rusty
    By ladrexler in forum Forms
    Replies: 0
    Last Post: 03-01-2011, 10:09 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