Results 1 to 2 of 2
  1. #1
    Zoroxeus is offline Novice
    Windows Vista Access 2007
    Join Date
    Dec 2005
    Posts
    12

    [Access 2007] fix bad design

    Hi
    i imported an excel file with the following strcture:
    Field A: Accronym
    Field B: Label1


    Field C: Label2
    Field D: Label3
    (plus an primary key when i imported)

    Sometimes Field C and D are empty.

    What I am looking in doing is to get a good desgin is three tables
    one with the accronyms, another one with the labels (without double in the unlikely event there were double labels) and the third table joining the two tables. Accronyms are unique.

    I am just unsure how i can do other thsn typing it all ?
    I tried to table analysis tool... but i can't do what i want to.
    Do you have any idea ?

  2. #2
    recyan's Avatar
    recyan is offline Expert
    Windows 2K Access 2000
    Join Date
    Dec 2011
    Posts
    662
    Just check out if below gives some guidelines :
    Assuming table structure :

    myTable
    AcronymnID - PK
    Acronymn - Assuming Unique in this table
    Label1
    Label2
    Label3

    The first query to run :
    qrytblAcronymns

    Code:
    SELECT DISTINCT 
        myTable.AcronymnID, 
        myTable.Acronymn 
    INTO 
        tblAcronymns
    FROM 
        myTable;
    The 2nd query to run :

    qrytblLabels


    Code:
    SELECT
    Label1 AS Label 
    INTO 
        tblLabels
    FROM 
        (
            SELECT Label1 FROM myTable WHERE Label1 Is Not Null
            UNION 
            SELECT Label2 FROM myTable WHERE Label2 Is Not Null 
            UNION 
            SELECT Label3 FROM myTable WHERE Label3 Is Not Null 
        );
    The 3rd query :
    qrytblAcronymnLabels
    Code:
    SELECT 
        AcronymnID AS Acronymn_ID, 
        Label1 AS Labels 
    INTO 
        tblAcronymnsLabels
    FROM 
        (
            SELECT AcronymnID, Label1 FROM myTable WHERE Label1 Is Not Null
            UNION 
            SELECT AcronymnID, Label2 FROM myTable WHERE Label2 Is Not Null 
            UNION 
            SELECT AcronymnID,Label3 FROM myTable WHERE Label3 Is Not Null 
        );
    Thanks
    Last edited by recyan; 04-18-2012 at 04:15 AM. Reason: Removed extra code box

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

Similar Threads

  1. Replies: 2
    Last Post: 05-02-2017, 05:46 PM
  2. Export Table in Access 2007 to Multiple Workbooks in Excel 2007
    By hutchinsm in forum Import/Export Data
    Replies: 5
    Last Post: 03-01-2012, 05:23 PM
  3. Ms Access 2007 report export to excel 2007
    By Stan2man in forum Access
    Replies: 6
    Last Post: 11-23-2011, 01:24 PM
  4. Replies: 2
    Last Post: 06-18-2011, 09:55 AM
  5. Replies: 0
    Last Post: 11-17-2009, 02:35 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