Results 1 to 5 of 5
  1. #1
    3 Star Lounger
    Join Date
    Dec 2000
    Location
    Ohio - USA, Ohio, USA
    Posts
    294
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Expression/Function (Access 2000)

    I am struggling with an expression:

    If [RelationshipToClient]="Husband" or "Wife", I need the control to return Husband or Wife as the case may be. If not either husband or wife, I just need a blank cell.

    =IIf([KinRelationshiptoClient]="Husband","Husband"," "#OR# ,=IIf([KinRelationshiptoClient]="Wife","Wife"," "

    I know this is going to end up being simple but in the past two years I not been working with Access very much and it's like I went back to Day 1. I went back to some previous work and can't find anything similar so I wonder if anyone can help.

    Thanks

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Expression/Function (Access 2000)

    You can use

    =IIf([KinRelationshiptoClient]="Husband","Husband",IIf([KinRelationshiptoClient]="Wife","Wife",Null))

    or

    =IIf([KinRelationshiptoClient]="Husband" Or [KinRelationshiptoClient]="Wife",[KinRelationshiptoClient],Null)

  3. #3
    3 Star Lounger
    Join Date
    Dec 2000
    Location
    Ohio - USA, Ohio, USA
    Posts
    294
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Expression/Function (Access 2000)

    Exactly!

    Thanks so much.

  4. #4
    3 Star Lounger
    Join Date
    Dec 2000
    Location
    Ohio - USA, Ohio, USA
    Posts
    294
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Expression/Function (Access 2000)

    Funny thing about this expression though. I tried taking it a little further, i.e.

    =IIf([RelationshiptoClient]="Husband",[FNAME] & " " & [LNAME],IIf([RelationshiptoClient]="Wife",[FNAME] & " " & [LNAME],Null))

    This worked just beautifully. However, I then wanted to use it to suppress other controls in certain situations so I used the following for Address, City, State, and Zip

    =IIf([RelationshiptoClient]="Husband",[ADDRESS],IIf([RelationshiptoClient]="Wife

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Expression/Function (Access 2000)

    Check very carefully that all the control names you use are valid and available. If Address is spelled differently, or not available on the form, you'll get errors.

Posting Permissions

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