Results 1 to 6 of 6
  1. #1
    New Lounger
    Join Date
    Jan 2001
    Location
    Edinburgh, Scotland, UK
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Concatenating strings

    I have an Excel 2000 worksheet that contains 3 address fields, Address1, Address2, Address3. I want to concatenate them into a single "Address" field, with line breaks separating what was previously the three separate fields. I can do this easily in Excel using the concatenation operator "&" and the Excel functin CHAR(10) to add line breaks to the end of each separate field. When I import the data into Access however it appears as a single line with what I take to be the CHAR(10) character showing as a bullet. How do I concatenate this data (either in Excel or Access 2000) so that it breaks correctly in Access?

  2. #2
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: Concatenating strings

    Hi Gordon,
    You could try using CHAR(13)&CHAR(10) to concatenate each row in Excel before importing (e.g. =A1 & CHAR(13) & CHAR(10) & A2) and it should then import OK.
    Hope that helps.
    Regards,
    Rory

    Microsoft MVP - Excel

  3. #3
    New Lounger
    Join Date
    Jan 2001
    Location
    Edinburgh, Scotland, UK
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Concatenating strings

    Rory,
    Thanks for the prompt reply. I tried your suggestion but it still doesn't work. Curiously, when I create a table in Access with broken lines and import it into Excel it seems as if Access is using CHAR(10) and CHAR(13) but when I do it the other way round I simply get a continuous line of text interspersed with one or two characters that look like filled circular bullets, which I assume are what Access is using to represent the CHAR(10) and CHAR(13) entered in Excel. Any more ideas?
    Gordon

  4. #4
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: Concatenating strings

    Hi Gordon,
    I confess I'm surprised - I tested the import on my Excel2000 and Access2000 and it worked fine as long as I did the concatenation using CHAR(13)&CHAR(10) - it still produced the linefeed symbols if I used CHAR(10)&CHAR(13) for some reason.
    If that doesn't work on yours, I guess I'd suggest importing the address fields as they are and then concatenating them in Access if you need to (or leaving them separate and simply combining the fields when displaying the address on a form or report)
    If you want any help with that let me know.
    Regards,
    Rory

    Microsoft MVP - Excel

  5. #5
    New Lounger
    Join Date
    Jan 2001
    Location
    Edinburgh, Scotland, UK
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Concatenating strings

    Rory,
    You're a genius! I'm sorry, I hadn't appreciated the significance of the sequence of the CHAR functions. CHAR(13) & CHAR(10) in that order works fine.
    Gordon

  6. #6
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: Concatenating strings

    You can probably guess how annoyed I was when I first found out that that was why an import I was trying to do wouldn't work properly! These little things are sent to try us.... <img src=/S/grin.gif border=0 alt=grin width=15 height=15>
    Regards,
    Rory

    Microsoft MVP - Excel

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •