Results 1 to 5 of 5
  1. #1
    Join Date
    May 2004
    Posts
    56

    Unanswered: Hard return in memo field/query

    Here's something that may be tricky. I have an append query that for one field pulls description text from "Source 1" and "Source 2" (two different fields in another, linked table), then concatenates the text into one field with a fixed separator character " / ." Users do not find that clear enough and I've been asked whether I can break the text with a hard return. In memo fields you can add them with the ENTER key. But can I add any text to my query string to insert a hard return after "Source 1" text?

    Eager to hear some creative ideas! (Hopefully I'm not overlooking something easy/obvious.) Thanks in advance.

  2. #2
    Join Date
    Feb 2004
    Location
    Chicago, IL
    Posts
    1,312
    Create a calculated field in your query:

    Field:[Source1] & Chr(13) & Chr(10) & [Source2]

    Field (you can use a better name) will be the source for your memo field.

  3. #3
    Join Date
    Sep 2004
    Location
    Charlotte, NC
    Posts
    164
    Usually, if you want to do this in a text field in a table you use <Ctrl>+<Enter>, but to append this into another table, I think this should work.

    INSERT INTO Table2 ( Field1 )
    SELECT [source1] & "
    " & [source2] AS JoinedFields
    FROM Table3;

    I tried this out in a sample DB and it worked. The only thing you will need to do is double the row height in the table that you append to so you can see the additional line in the field after the hard return.

    TD

  4. #4
    Join Date
    Sep 2004
    Location
    Charlotte, NC
    Posts
    164
    DCKunkle,

    Sorry about posting the reply after you had already provided a solution. There was no reply when I started writing mine and then I got sidetracked (for some reason they want me to earn my paycheck ) and when I finally posted, I saw your reply. BTW, is Chr(13) equal to <Ctrl> and Chr(10) equal to <Enter>?

    TD

  5. #5
    Join Date
    Mar 2004
    Location
    belgium
    Posts
    290
    The control key = vbkeycontrol = 17
    the enter key = vbkeyreturn = 13
    Carriage return = chr(13) = vbCr
    Linefeed = chr(10) = vbLf
    carriage return and linefeed = vbCrLf

Posting Permissions

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