Results 1 to 2 of 2
  1. #1
    Eitas is offline Novice
    Windows XP Access 2007
    Join Date
    May 2011
    Posts
    5

    from excel - multiple column to one

    I am trying to convert an excel sheet to access. This is a sheet to track when a task needs to be done and when it was done.

    The excel sheet has a column for each task and each date. So if task A needs to be done monthly there are 12 columns for that task.

    The issue is not all tasks are needed for each record and from what I know of DB design multiple rows are better than multiple columns. I am looking at converting the data from

    name, report Jan, report Feb, report mar, ....

    to
    Name, type, date

    with type being the type of task that has to be done.

    Is there a way to quickly change the data from multiple columns to multiple rows.



    I hope this makes sense.

    Thanks.

    PS: What I tried was several append equerries one for each task and for each month. I am hoping there is an easier way.

  2. #2
    alansidman's Avatar
    alansidman is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,529
    I think that you can do this with a series of Union Queries for each of the month columns in your table.
    Code:
    Select table.[Name], table.[type], table.[report Jan] As reportMonth
    from table
     
    Union
     
    Select table.[Name], table.[type], table.[report Feb]
    from table
     
    Union
    Select table.[Name], table.[type], table.[report Mar]
    from table
     
    etc.
    BTW, the term Name is a reserved word in Access and you should use something else or enclose it in square brackets to avoid future issues.


    Here is a link on Union Queries

    http://www.w3schools.com/sql/sql_union.asp

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

Similar Threads

  1. Excel Automation Autofit Column (or Cell?) Width
    By orcinus in forum Programming
    Replies: 3
    Last Post: 02-09-2011, 11:44 AM
  2. Multiple column display on form
    By RANCHLAW56 in forum Forms
    Replies: 1
    Last Post: 01-06-2011, 02:44 PM
  3. Replies: 3
    Last Post: 12-21-2010, 11:52 AM
  4. Import to Excel from Access column of LOOKUP data type
    By Derek in forum Import/Export Data
    Replies: 1
    Last Post: 12-06-2010, 06:27 PM
  5. Replies: 2
    Last Post: 08-19-2010, 09:33 AM

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