Results 1 to 4 of 4
  1. #1
    stuey is offline Novice
    Windows 7 64bit Access 2013 32bit
    Join Date
    Dec 2017
    Posts
    2

    Fields that auto-concatenate others

    Hi folks



    I'm just getting my feet wet with Access so I'm doing a little project that ultimately will (might?) interface with my personal ledger spreadsheet.

    I want to keep track of the different stores/restaurants/gas stations I go to, and one column in my "Merchants" table has the name of the chain (or the standalone store name if it's not part of a chain) and a separate field has the location name (if there is one on the receipt, the way Target and some other stores do) and another separate field has the store number (if known).

    Is it possible to create an additional field that will contain a concatenation of a chain name & location name? For instance, in record #14, the chain name is "Target" and the loc name is "Ridgedale" (the store is in the Ridgedale section of Minnetonka, Minnesota thanks for asking). Can I create a field, say "fullname" and in this particular record it would (I risk the obvious) read "Target Ridgedale?"

    I know Excel does that very easily with the & operator but I'm clueless about Access.


    ========
    OPTIONAL: Lengthy, plodding answers to anticipated questions
    ========
    Q. Why the heck don't you just have one, "fullname" field take care of business in the first place instead of two silly fields?
    A. Granularity.

    Q. So then why do you want this less-granular fullname field in addition?
    A. When I fill out my ledger spreadsheet, there is one, only ONE Excel column for "Merchant." "Target Ridgedale," "Lunds&Byerlys Plymouth," "CVS #6810" are sample values, and Excel's auto-complete feature gets a lot of use from me (don't we all usually visit the same handful of stores). When I click "Save" after making new ledger entries, a VBA script is going to get the value in "Merchant" and then dig my Access database for that merchant (hopefully querying this "fullname" field I'm dreaming of). The database also has info on city & state for each retailer, those values will be gleaned from Access and copied into the "city" and "state" columns on the spreadsheet. (Other whiz-bang stuff will take place as well but that's looking too far ahead.)

    So! Auto-concatenated fields. Can it be done?

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    This is a simple concatenation calculation. Can be done in Calculated field in table or in query or in textbox on form or report. Example:

    [field1] & ":" & [field2]
    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.

  3. #3
    stuey is offline Novice
    Windows 7 64bit Access 2013 32bit
    Join Date
    Dec 2017
    Posts
    2
    Aha! That's it exactly; thanks June7!!!

  4. #4
    isladogs's Avatar
    isladogs is offline Access MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    6,204
    Just do the concatenation using a query.
    Calculated values in tables rarely serve any benefit whatsoever

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

Similar Threads

  1. How to concatenate 3 fields?
    By nicoboss in forum Access
    Replies: 9
    Last Post: 11-22-2017, 11:04 AM
  2. How to concatenate fields
    By aparnawangu in forum Access
    Replies: 1
    Last Post: 10-28-2015, 01:03 AM
  3. Concatenate two fields
    By buckwheat in forum Access
    Replies: 8
    Last Post: 06-28-2013, 07:06 AM
  4. Concatenate Fields
    By Njliven in forum Forms
    Replies: 9
    Last Post: 12-21-2012, 08:31 AM
  5. Merge fields (not concatenate)
    By sberti in forum Access
    Replies: 2
    Last Post: 11-30-2012, 12:53 AM

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