Results 1 to 6 of 6
  1. #1
    Jerseynjphillypa is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Apr 2012
    Posts
    83

    Move Data to Next Column Over


    Is there an easier way to transfer the data table to the next column over in the Final Table.

    So if there is data under Jan2012 in the data table, it should be moved to the Final table in Feb2012 field by Item .
    Attached Files Attached Files

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Since table is empty, you could run an INSERT SELECT sql action.
    INSERT INTO [Final Table](Item, [Feb 2012])
    SELECT Item, [Jan 2012]
    FROM [Data Table];

    If the FinalTable already has records, run an UPDATE sql action.

    This table is not normalized structure. How many years will this table need to handle?
    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.

  3. #3
    Jerseynjphillypa is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Apr 2012
    Posts
    83
    I would like for it to continue until the last column that appears in the table

    So the last month that should appear in the Final Table is July 2012.

    But the field name will change the next time I update the table. So is there a faster way without listing the names in the SQL

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    You won't have data into 2013, 2014, 2015, etc?

    Options:

    1. Manually edit the Access query object.

    2. Use VBA to construct and execute the SQL action. The code would reference controls on a form where you would input the field names.
    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
    Jerseynjphillypa is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Apr 2012
    Posts
    83
    Yes I will have data going into 2013, 2014, 2015, etc?

    If I do it with Option 2, Could you show me an example how to do it with controls

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Data is not in a normalized structure. Only 255 fields allowed in a table. That will allow 21.5 years. Probably enough for your needs.

    Code in some event (perhaps button click) behind a form would be like:

    CurrentDb.Execute "INSERT INTO [Final Table](Item, [" & Me.textboxname1 & "]) SELECT Item, [" & Me.textboxname2 & "] FROM [Data Table];"


    If you need better understanding of programming in Access, review http://office.microsoft.com/en-us/ac...010341717.aspx
    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. Replies: 1
    Last Post: 12-08-2011, 08:03 AM
  2. move value in column to row
    By Avi in forum Access
    Replies: 5
    Last Post: 05-04-2011, 12:41 PM
  3. Using a query to move data to new columns
    By emunson in forum Queries
    Replies: 2
    Last Post: 12-01-2010, 10:16 PM
  4. Replies: 1
    Last Post: 08-09-2010, 03:59 PM
  5. Move data from one table to another
    By rebyrd in forum Queries
    Replies: 2
    Last Post: 12-24-2009, 12:52 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