Results 1 to 4 of 4
  1. #1
    Peter_M is offline Novice
    Windows 10 Access 2010 64bit
    Join Date
    Apr 2021
    Posts
    2

    Concatenating two fields in a form

    Hi everybody
    In a sub-form I am attempting to concatenate two fields, storing the result in another field in the sub-form, and indeed in the same table.
    The two fields that are being concatenated are primary primary keys of two tables, and the resulting concatenated field becomes a primary key to be used to link to another table.

    The attempted VB code is
    [ATR ID].Value = [AT ID].Value&[Resident ID].Value
    on an updating event of selecting the [AT ID] value from a combo box.

    I'm choosing to do it this way with text ID fields - rather than autonumber fields.

    Any ideas please.



    Cheers
    Peter M

  2. #2
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,643
    Any ideas on what?
    Are you getting an error? Is it not working?

    Seems like a pretty unusual way of doing things. Why not use an autonumber PK and 2 foreign keys? I'm assuming your doing this so you can relate to the 2 Pk's.
    If this helped, please click the star * at the bottom left and add to my reputation- Thanks

  3. #3
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    You haven't said what goes wrong, or what error you get, or... The code you provided, presuming the lack of spaces gets fixed, should work.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #4
    Join Date
    May 2018
    Location
    Living in Scotland UK
    Posts
    1,557
    Hi Peter

    Can you upload a zipped copy of the database?
    You can PM me if you need further help.
    Good Reading https://docs.microsoft.com/en-gb/off...on-description

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

Similar Threads

  1. Concatenating related fields
    By btappan in forum Access
    Replies: 10
    Last Post: 03-15-2019, 05:57 AM
  2. Replies: 4
    Last Post: 11-11-2017, 09:43 PM
  3. Replies: 10
    Last Post: 04-24-2015, 01:28 PM
  4. Concatenating fields from matching records
    By MWMike in forum Queries
    Replies: 1
    Last Post: 10-28-2010, 10:49 PM
  5. Concatenating many fields into one field
    By olidav911 in forum Programming
    Replies: 1
    Last Post: 08-13-2009, 05:14 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