Results 1 to 5 of 5
  1. #1
    2 Star Lounger
    Join Date
    Mar 2001
    Location
    Northern, NJ, New Jersey, USA
    Posts
    107
    Thanks
    0
    Thanked 0 Times in 0 Posts

    First & Last Name Together (Access 2000 SR-1)

    I am sure this can be done and I am guessing it is something easy that I missed in the books -So here goes...

    I have 2 separate data fields in a table
    [first_name] and [last_name]

    On a report I would like to show the name as
    "Smith, John"

    What is the proper formatting of the field or control to combine the 2 separate fields into one on the report?

    Thanks!
    There is always a way.

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: First & Last Name Together (Access 2000 SR-1)

    Delucmi,
    the syntax is
    =[first_name] & " " & [last_name]

    If you want to avoid the space before Last_name in case First_name is empty :

    =IIf(IsNull([first_name]),[last_name],[first_name] & " " & [last_name])
    Depending your windows settings, the commas has to be replaced with semi-colons
    Francois

  3. #3
    2 Star Lounger
    Join Date
    Mar 2001
    Location
    Northern, NJ, New Jersey, USA
    Posts
    107
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: First & Last Name Together (Access 2000 SR-1)

    Absolutely PERFECT!

    Thank you very much!
    There is always a way.

  4. #4
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: First & Last Name Together (Access 2000 SR-1)

    There's also a tricky way to do this:

    = ([first_name] + " ") & [Last_Name]

    The first part of the expression will return a Null if the [first_name] is empty.
    Charlotte

  5. #5
    2 Star Lounger
    Join Date
    Dec 2000
    Posts
    188
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: First & Last Name Together (Access 2000 SR-1)

    There's also exactly what you asked for:
    = [Last_name] & ( ", "+[First_Name])

    And it's really not Tricky. The Plus sign says return Null if the First_Name field is blank. The Ampersand says to combine strings whether blank or not. So if you used an Ampersand and a First_Name was blank, you would get
    Smith,
    Instead of
    Smith

    FWIW

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •