Results 1 to 8 of 8
  1. #1
    vojinb is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Jul 2011
    Posts
    18

    Exclamation merge or concatenate two rows in one

    Hi,
    I have column in table (imported from txt file) where two rows next to each other belong to same data like:
    column1


    row1 LD.1.TR.EUR.21050.1009.1700.Y .YU . YU.
    row2 1.T.LONG.99

    How can I concatenate or append lower row to row above to have it like :
    row1: LD.1.TR.EUR.21050.1009.1700.Y .YU . YU.1.T.LONG.99
    Thanks

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    Row1 & Row2 will concantentate them in a query.

    You can perform an update query on your table in the same manner

  3. #3
    vojinb is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Jul 2011
    Posts
    18
    Quote Originally Posted by rpeare View Post
    Row1 & Row2 will concantentate them in a query.

    You can perform an update query on your table in the same manner
    Wel, how? I have 46000 records with diferent row values.

  4. #4
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    oh I misunderstood I thought you had a column with the first value and a column with the second value.

    so I have a couple of questions

    Is the first line ALWAYS the start of a line and is the second line ALWAYS an addendum to the first line?

    or can it be something like

    Beginning Line 1
    Ending Line 1
    Beginning Line 2
    Beginning Line 3
    Ending Line 3

    Where your second line (in your sample data) is an optional line?

    if so how do you determine a line is the 'first' part of the string do they all begin with LD?

  5. #5
    vojinb is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Jul 2011
    Posts
    18

    Question merge or concatenate two rows in one

    Hi,
    here is example from imported txt:

    column1
    PD.1.TR.EUR.21054.4006.1500.9700\01.YU
    YU.1602...1

    The thing is that second line of column1 is just broken line of value of first line in column1. The only thing I see is that second line always has significant less characters than first one.
    Could it be to create query like:
    If column1 has < then 20 characters then concatenate it to row above?

  6. #6
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    You aren't answering my question.

    are there ALWAYS two rows for each line you want to make? Will there ALWAYS be two lines for each 1 record you want? or is there a possibility there will be only ONE row.

    Secondly how is this data coming to you? are you importing it from another source? If so you could do something when you import the data to correctly link the two pieces of the field. What I really need to know is will there always, always always, be two lines that belong together, if it's variable (could be 0, could be more than 1) it's more complicated.

  7. #7
    vojinb is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Jul 2011
    Posts
    18
    No,
    There is no always two lines, sometimes is one, sometimes two, but the condition that is certain is that if second line exist then is always no more then 20 char,and first line is always biger than 35 char.
    Unfortunately the source file could not corrected before Import. And the thing I have in mind is to check length of each row, and if is less then 20 char to concanate it to row above
    Like
    "if len(name)<20 then name=name&name where id=id-1". But don't know how to code it



    QUOTE=rpeare;70779]You aren't answering my question.

    are there ALWAYS two rows for each line you want to make? Will there ALWAYS be two lines for each 1 record you want? or is there a possibility there will be only ONE row.

    Secondly how is this data coming to you? are you importing it from another source? If so you could do something when you import the data to correctly link the two pieces of the field. What I really need to know is will there always, always always, be two lines that belong together, if it's variable (could be 0, could be more than 1) it's more complicated.[/QUOTE]

  8. #8
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    If you are importing your data it can be done on the import, if you're using a linked table then you can't. The import would just have to be a custom built import as opposed to a default settings import. There has to be some way to sort the items sequentially so you know which two rows are supposed to be attached. Are you importing into an Access table or are you linking data from an outside source? That's important to know (to me anyway) If you are, in fact importing the data that's probably the easiest way to deal with your issue. If it isn't does your table have a way to reliably sort the data so you are always reading the lines in the order they should be read?

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

Similar Threads

  1. Help needed - Trying to concatenate rows
    By clarkian11 in forum Queries
    Replies: 15
    Last Post: 06-09-2011, 10:11 AM
  2. Replies: 6
    Last Post: 04-07-2011, 12:33 PM
  3. Concatenate Multiple Rows into One
    By Knarly555 in forum Queries
    Replies: 5
    Last Post: 11-12-2010, 06:51 PM
  4. concatenate
    By stephenaa5 in forum Programming
    Replies: 2
    Last Post: 10-11-2010, 05:18 PM
  5. Concatenate Formula
    By Shingo in forum Programming
    Replies: 1
    Last Post: 07-25-2009, 09:14 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