Results 1 to 6 of 6
  1. #1
    grittsm8 is offline Novice
    Windows Vista Access 2007
    Join Date
    Apr 2014
    Posts
    3

    RunSQL combine the value of two fields

    I have two fields (WHNO and case) in a table that I need to combine (concatenate) into another field (join, which I want to be WHNO-case).



    What is the best method to accomplish this. I've tried UPDATE, but I don't know how to properly write the SET portion (I don't need the WHERE). I've also tried SELECT...AS... but I haven't had any luck.

    I can't find how to properly write the expression to combine the two fields.


    Thanks for the help.

  2. #2
    grittsm8 is offline Novice
    Windows Vista Access 2007
    Join Date
    Apr 2014
    Posts
    3
    My current solution is to use an update query to update the join field with the WHNO and case and in the module use the DoCmd.OpenQuery

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Why do you need to save the concatenated value? Saving calculated data (data dependent on other data) is often bad idea and/or just not necessary. The concatenation can be calculated whenever needed.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  4. #4
    grittsm8 is offline Novice
    Windows Vista Access 2007
    Join Date
    Apr 2014
    Posts
    3
    I need to use the concatenated value as a join with another table. I need the join to make records in the table unique. WHno and case have can be repeated, some WHno records have multiple case records. I need to make sure data from the case field doesn't correspond to each WHno. Concatenating those two values will ensure that the data corresponding to a single WHno and case is correct. I guess I can use a compound key. Or Excel as this data needs to pass through Excel in order to be formatted properly from it's source.

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Alternative is to build a query that creates field with concatenation expression.

    Use that query to join to other table.

    Just thought you might want to know options.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  6. #6
    robrich22's Avatar
    robrich22 is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Feb 2013
    Location
    Louisville, KY
    Posts
    41
    SELECT Whno + "-" + case AS WHNO-Case FROM MyTable;

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

Similar Threads

  1. Combine Fields
    By enjiel in forum Queries
    Replies: 1
    Last Post: 09-17-2013, 11:36 AM
  2. need to combine two fields
    By jwallace203 in forum Access
    Replies: 1
    Last Post: 07-29-2011, 07:11 PM
  3. combine two fields into one
    By kbremner in forum Programming
    Replies: 1
    Last Post: 10-29-2010, 07:40 AM
  4. Combine two fields, Null fields involved
    By yes sir in forum Access
    Replies: 9
    Last Post: 10-03-2010, 09:20 AM
  5. Combine fields into one
    By cotri in forum Forms
    Replies: 2
    Last Post: 03-04-2010, 02:42 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