Results 1 to 4 of 4
  1. #1
    billybeer is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Jun 2015
    Posts
    27

    Combine two columns of query not columns from table

    I have a query that can combine two columns from a table: Name for combining first and last names: [DFLNAME] & ", " & [DFFNAME]
    However, my query makes some changes to the DFFNAME column from the table (chops off the middle name when included so now the column in the query for DFFNAME is Expr1: IIf(InStr([DFFNAME]," ")>0,Left([DFFNAME],InStr([DFFNAME]," ")-1),[DFFNAME])
    I would like to combine the first name and last name columns that were returned in the query i.e. the first name without any middle names and last name. Can I do this in this query or can/must I do it later when doing a report based on this query. Thanks

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,954
    You can replace Expr1 with an alias name of your preference, such as: FName

    Just create another field with that concatenates the calculated field with DFLNAME.

    FullName: FName & DFLNAME

    Or just concatenate DFLNAME with the expression and call the field FullName.
    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
    JoeM is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Just substitute that calculation in where the field was, i.e.
    [DFLNAME] & ", " & IIf(InStr([DFFNAME]," ")>0,Left([DFFNAME],InStr([DFFNAME]," ")-1),[DFFNAME])

  4. #4
    billybeer is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Jun 2015
    Posts
    27
    Works. Thanks again.

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

Similar Threads

  1. Replies: 2
    Last Post: 10-26-2015, 06:14 AM
  2. Replies: 1
    Last Post: 10-31-2014, 02:27 PM
  3. Replies: 5
    Last Post: 08-22-2014, 05:01 AM
  4. How to combine two columns into one
    By JRCharlie in forum Queries
    Replies: 4
    Last Post: 01-20-2013, 01:09 AM
  5. If columns are similar combine?
    By westcoastbmx in forum Queries
    Replies: 0
    Last Post: 09-04-2009, 12:54 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