Results 1 to 9 of 9
  1. #1
    ssu is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jul 2014
    Posts
    5

    Calculated field.

    Does anybody know how to
    " Add a calculated field named CustomerName as the first column that is either the company or the concatenation of the last name, a comma a space, and the first name. Sort in ascending order by Customer Name ?"



    I've came up with CustomerName: IIf([CompanyName] , [LastName] & ", " & [FirstName])
    and it doesn't work...help!

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,642
    Homework? I'd use IsNull() to test the company name, and you haven't filled in the False argument of the IIf().
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    ssu is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jul 2014
    Posts
    5
    What's the false argument?
    Thanks for the reply-

  4. #4
    ssu is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jul 2014
    Posts
    5
    I've come up with CustomerName: IIf(IsNull([Company Name]),[Last Name] & ", " & [First Name])
    But the fields that have company name values don't show any field values,,

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,642
    Have you looked in help at the IIf() function? It has 3 parts, you've only used 2.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #6
    ssu is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jul 2014
    Posts
    5
    you mean the <<falsepart>>? but I am not sure what to put there,,

  7. #7
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,642
    You put what you want the function to return if the test is false (company name isn't Null).
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  8. #8
    ssu is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jul 2014
    Posts
    5
    I put [LastName] but it still doesn't work....

  9. #9
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,642
    If company name isn't Null don't you want...company name?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 4
    Last Post: 03-20-2014, 03:52 PM
  2. Replies: 2
    Last Post: 12-15-2013, 02:29 AM
  3. Replies: 1
    Last Post: 04-21-2013, 03:20 PM
  4. Replies: 3
    Last Post: 02-13-2013, 10:15 AM
  5. Calculated field help
    By eds in forum Access
    Replies: 2
    Last Post: 07-18-2011, 05:33 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