Results 1 to 5 of 5
  1. #1
    MTSPEER is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2013
    Posts
    283

    Query to insert a field in the beginning of another

    Hello,



    I have to fields Field1 and Field2. The table name is called Table1. I'm trying to figure out how to Insert Field1 into the beginning of Field2 with a space in between so it is all one sentence. For example if Field1 is someone's name like "Mark", and Field2 is "is a professor". Trying to combine them to show "Mark is a professor" in Field2. Is there a way to make this in an update query?

    Thank You

  2. #2
    Rawb is offline Expert
    Windows 7 64bit Access 2010 32bit
    Join Date
    Dec 2009
    Location
    Somewhere
    Posts
    875
    It would probably be better to create a calculated Column in a SELECT Query that does this. That way you're not continually modifying your data (and adding Field1 to Field2 over and over and over).

    Code:
    SELECT Field1 & " " & Field2 AS CalculatedField
    FROM Table1

  3. #3
    MTSPEER is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2013
    Posts
    283
    I just need all the information in the same table.

  4. #4
    Rawb is offline Expert
    Windows 7 64bit Access 2010 32bit
    Join Date
    Dec 2009
    Location
    Somewhere
    Posts
    875
    It already is in one Table...

    But if you're set on doing it that way, then this should work:
    Code:
    UPDATE Table1
    SET Field2=Field1 & " " & Field2
    Or, if this is something that could potentially be run more than once, you will want to check fields to see if you've already combined them:
    Code:
    UPDATE Table1
    SET Field2=Field1 & " " & Field2
    WHERE NOT Left(Field2, Len(Field1 & ""))=Field1

  5. #5
    MTSPEER is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2013
    Posts
    283
    Thanks so much!

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

Similar Threads

  1. Replies: 3
    Last Post: 05-15-2014, 03:38 PM
  2. INSERT query: insert new data only
    By drh in forum Access
    Replies: 2
    Last Post: 04-04-2014, 05:31 PM
  3. Replies: 6
    Last Post: 12-05-2013, 09:55 AM
  4. Replies: 3
    Last Post: 01-27-2012, 05:32 PM
  5. Replies: 3
    Last Post: 03-05-2011, 12:46 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
  •  
Other Forums: Microsoft Office Forums