Results 1 to 7 of 7

How to enter onto a different Line in a query

  1. #1
    CP611 is offline Novice
    Windows 10 Access 2016
    Join Date
    Nov 2017
    Posts
    22

    How to enter onto a different Line in a query

    Hello,

    My current query is showing as ADDRESSLINE1: StrConv([Address],3) & "|" & StrConv([Address2],3) to incorporate 2 address lines into 2 with a | in between and correctly formatted. However, I need Address2 to be moved onto the new line so when a spreadsheet is outputted it looks like the below for example, but within one cell:

    6 The Station
    London



    I have tried putting Ctrl + Enter in between the " " instead of a | but that doesn't seem to work.

    Any help

  2. #2
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    19,096
    Try

    StrConv([Address],3) & Chr(13) & Chr(10) & StrConv([Address2],3)
    Paul (wino moderator)
    MS Access MVP
    www.BaldyWeb.com

  3. #3
    ranman256's Avatar
    ranman256 is online now VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    7,032
    Chr(13) & Chr(10) is also vbCRLF

  4. #4
    CP611 is offline Novice
    Windows 10 Access 2016
    Join Date
    Nov 2017
    Posts
    22
    I have tried Chr(13) & Chr(10) but that doesn't work, it just comes out like 6 The StationLondon. I tried vbCRLF instead but when I went to convert it it told me to put in a parameter value for vbCRLF?

    Thanks!

  5. #5
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    19,096
    Just tested and it works as expected. You won't see the second line unless you drag the row height bar down. I assume it would show in Excel when exported.
    Paul (wino moderator)
    MS Access MVP
    www.BaldyWeb.com

  6. #6
    CP611 is offline Novice
    Windows 10 Access 2016
    Join Date
    Nov 2017
    Posts
    22
    thank you this works now

  7. #7
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    19,096
    Happy to help! FYI, vbCrLf would only work in VBA, which is why you got a parameter prompt trying to use it in a query.
    Paul (wino moderator)
    MS Access MVP
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 5
    Last Post: 01-24-2018, 09:45 AM
  2. Replies: 4
    Last Post: 12-23-2017, 10:25 AM
  3. Replies: 1
    Last Post: 10-03-2014, 05:06 AM
  4. Replies: 4
    Last Post: 03-11-2014, 05:38 PM
  5. Field auto enter new line on enter event
    By Ruegen in forum Forms
    Replies: 3
    Last Post: 09-17-2013, 08:00 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
  •  
Tech Forums: Microsoft Office Forums