Results 1 to 4 of 4
  1. #1
    Hiram is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    May 2018
    Location
    Southern Connecticut
    Posts
    2

    Creating new table by selecting unique values in one column from a flat spreadsheet file


    My company regularly gives me a flat file – an EXCEL spreadsheet – to analyze. The file typically runs 20,000 or more records. The items are in hierarchical form so that every item is a child of some other item in the same file, and many items are both parents of one set of children and also a child of one or more other items. This generational arrangement runs more than 20 levels. One column on every line has a alphanumeric code that uniquely identifies that item’s parent, but the parent’s ID code is repeated for every child the parent has. I need to pull a unique instance of each parent’s code into a separate table; it’s unimportant whether it is the first, second, last appearance of that code. I built an empty table mimicking the column names and created a unique index (this is how I used to do the same task in 4GL, which we no longer use), but Access vomited the entire 20K+ lines.

  2. #2
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    If the table exists:

    INSERT INTO TableName(FieldName)
    SELECT DISTINCT FieldName
    FROM SourceTable
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Hiram is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    May 2018
    Location
    Southern Connecticut
    Posts
    2
    Many thanks. I will try that.

  4. #4
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    No problem, and welcome to the site by the way!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 5
    Last Post: 06-23-2017, 12:11 AM
  2. Replies: 4
    Last Post: 12-29-2015, 03:25 PM
  3. Replies: 12
    Last Post: 12-27-2015, 02:17 PM
  4. Export Access table data to flat file (txt file)
    By edmscan in forum Import/Export Data
    Replies: 3
    Last Post: 06-17-2015, 12:03 PM
  5. Creating a Flat File with Signed Numeric Data Fields
    By two_smooth in forum Database Design
    Replies: 2
    Last Post: 10-27-2010, 08:31 AM

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