Attendee: Trim([Surname] & ", " & [FirstName] & IIf([Visitor?]="Yes"," (Visitor)","")) & IIf([Rank]="",""," " & Trim([Rank]))
I have the above criteria in a query, to produce atttendees of a meeting. If the field Visitor is Yes, then the word Visitor appears after the FirstName in brackets. If the attendee is a member of the police, then the rank appears after the FirstName. I would like the rank to appear in brackets. However, I don't want the brackets showing if there is nothing in the Rank field. I have tried several things with Trim, but each time I have got an empty pair of brackets, thus, () appearing after all the FirstNames. Please tell me how to get them to display only if there is something in the Rank field.
Thank you in anticipation.
Trimming brackets in criteria if nothing to go between them
-
- 4StarLounger
- Posts: 582
- Joined: 06 May 2012, 20:05
-
- Administrator
- Posts: 78391
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Trimming brackets in criteria if nothing to go between t
Try
Attendee: Trim([Surname] & ", " & [FirstName] & IIf([Visitor?]="Yes"," (Visitor)","")) & IIf([Rank] Is Null,""," (" & Trim([Rank]) & ")")
Attendee: Trim([Surname] & ", " & [FirstName] & IIf([Visitor?]="Yes"," (Visitor)","")) & IIf([Rank] Is Null,""," (" & Trim([Rank]) & ")")
Best wishes,
Hans
Hans
-
- 4StarLounger
- Posts: 582
- Joined: 06 May 2012, 20:05
Re: Trimming brackets in criteria if nothing to go between t
Perfect!!!
Thank you Hans!
Thank you Hans!