Results 1 to 7 of 7
  1. #1
    joemills62 is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    21

    combine text fields

    I have a data entry form called clients.



    I have text fields First Name, Surname, Contact Name

    I want the contact name fields to be a combination of the first name & surname field.

    I have code in afterupdate to say = me.first name & " " & me.surname

    when the form has been completed it add the data, but there is no data in the contact name field

    any help on this matter

    should i also have a save button on the form !!

  2. #2
    alansidman's Avatar
    alansidman is offline Indifferent
    Windows 7 32bit Access 2007
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,538
    You placed the formula in the afterupdate for the control contact name? Is this correct?

    Alan

  3. #3
    joemills62 is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    21
    Yes, its in the Afterupdate section

  4. #4
    alansidman's Avatar
    alansidman is offline Indifferent
    Windows 7 32bit Access 2007
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,538
    Are you able to post your db with some sample data? Make sure to remove any proprietary information and do a compact and repair before posting it.

    Alan

  5. #5
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,441
    in the onexit property of the surname field you could have


    me.ContactName = me.firstname & " " & me.surname

    But let me just say this. There's really no reason to do this. You can perform this concantentation of fields on any form, report or anything else and be able to search for a specific person or do anything else as though it were a field in your table. You're basically storing a bunch of data for no reason by making it an actual field in your database.

  6. #6
    joemills62 is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    21

    Re: text Fields

    I have tried this,

    me.ContactName = me.firstname & " " & me.surname

    On After update, and on exit

    And yet it still does not fill in the contact name field

    i have a button on a menu to add data, this opens a contact details form,

    i also have a save button on the form.

    The reason i want this field updated with the first name and surname is that there will be relation to it, from other data tables using the contact name

  7. #7
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,441
    ooooh that is a really, really, really bad idea to link on the contact name. You should be using a unique key field (autonumber) and definitely NOT the contact name. Let's assume for the sake of argument you type in a person's name incorrectly. Then you create some records in your other tables that are using the incorrect person's name. If you then go back and correct the name on your contacts table you will have orphaned all of the data on the other tables. I would very, very, very strongly recommend you add a unique key field to your contacts table and use that field as your link.

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

Similar Threads

  1. need to combine two fields
    By jwallace203 in forum Access
    Replies: 1
    Last Post: 07-29-2011, 07:11 PM
  2. Combine Two Fields in a Query?
    By Luke in forum Access
    Replies: 1
    Last Post: 07-28-2011, 10:00 AM
  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