Coding in a Report

G

Guest

I've attached my coding below from a text box in a report.
It's giving me the first initial of a persons first and
last name. It pulling three different field name and if
all are null then the word Agency is filled in, if not
there's a backslash between each initial. My question is I
sometime have a backslash before a single set of initials.
How do I get rid of it? Or code it differently?

Examples: SE/PJ/DD
/PK (I don't want the "/" before the
initials)(This example is pulling from [Capital Markets
Distributor]


=IIf([Capital Markets originator] Is Null,"",Mid([Capital
Markets originator],InStr(1,[Capital Markets
originator],",")+2,1) & Left([Capital Markets
originator],1)) & IIf([Capital Markets Distributor] Is
Null,"","/" & Mid([Capital Markets Distributor],InStr(1,
[Capital Markets Distributor],",")+2,1) & Left([Capital
Markets Distributor],1)) & IIf([Capital Markets Jr
Support] Is Null,"","/" & Mid([Capital Markets Jr
Support],InStr(1,[Capital Markets Jr Support],",")+2,1) &
Left([Capital Markets Jr Support],1)) & IIf([Capital
Markets originator] & [Capital Markets Distributor] &
[Capital Markets Jr Support] Is Null,"Agency")
 
D

Duane Hookom

I would never create an expression this complex. A user function would be
much easier to create and maintain. You could then use the function in any
query or control source or code.

If you don't know how to write a function, please reply back with some
sample field values and the expected "return" value.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top