Results 1 to 5 of 5
  1. #1
    JackieEVSC is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Oct 2011
    Posts
    70

    Question about IIf statement in query

    I have a query that parses out apostrophe's in student names. In some instances, there is no student name. When that happens, the results are "#Error" for both FirstName and LastName. (Because I'm forcing the field to be included by way of joins).

    The formatting for that field works unless there is no value ... LName: Replace([LastName],"'","").

    If there is no name, I need the LastName field to pull in "Inventory", and the FirstName field be blank. If there is a name, I need to remove all apostrophe's from it.

    Is it possible to do this with an IIf statement in a query?



    Thanks in advance for any help you can give me!

  2. #2
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    How about
    Code:
    LName: Replace(Nz([LastName],"Inventory"),"'","")
    FName: Nz([FirstName],"")

  3. #3
    JackieEVSC is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Oct 2011
    Posts
    70
    Thank you!!!!

  4. #4
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    You're welcome.

    Ready to mark this solved???

  5. #5
    JackieEVSC is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Oct 2011
    Posts
    70
    Yes, it is solved ... and I am so thankful for your help!!

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

Similar Threads

  1. Beginner question, related to if statement.
    By nstasiak in forum Access
    Replies: 3
    Last Post: 05-11-2015, 05:56 PM
  2. Replies: 1
    Last Post: 03-06-2015, 11:16 AM
  3. IFF statement script question
    By shin_mitsugi in forum Access
    Replies: 3
    Last Post: 05-15-2014, 01:59 PM
  4. Iff Statement Question
    By LanieB in forum Queries
    Replies: 3
    Last Post: 01-11-2013, 03:44 PM
  5. Replies: 6
    Last Post: 01-05-2013, 05:23 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