How do I use Len function to include spaces between text?

JLevi

New member
Local time
Today, 11:39
Joined
Aug 9, 2012
Messages
6
I am creating a report which is taking text from 2 columns in a table and putting them on the same line. I have it working except my Len function does not seem to be counting spaces and also seems to be inconsistent. Any ideas for what I am doing wrong?

Control source for the text box:

=IIf(IsNull([Author]),"",Space(Len(nz([Genus spp]))+2) & Nz([Author]))
I am trying to have the author data be 2 spaces after the text in Genus spp. The format for Genus spp is: i.e. Acer rubrum. Two words with a space between.
The result seems sporadic and doesn't appear to be including the space between the two words in Genus spp.
Is there another expression that I should be using?
Thank you,
Jeff
 
All you need if you want it to be two spaces after is just

=IIf(IsNull([Author]), "", [Genus spp] & " " & Nz([Author], ""))

I think the forum is stripping the extra space but the part in between has two spaces (I'll use dots to represent the spaces)

=IIf(IsNull([Author]), "", [Genus spp] & ".." & Nz([Author], ""))
 
Last edited:
All you need if you want it to be two spaces after is just

=IIf(IsNull([Author]), "", [Genus spp] & " " & Nz([Author], ""))

I think the forum is stripping the extra space but the part in between has two spaces (I'll use dots to represent the spaces)

=IIf(IsNull([Author]), "", [Genus spp] & ".." & Nz([Author], ""))

This worked, but it overwrote the Genus spp I had behind it. I would like this to not display the data in Genus spp as I am already displaying it in a text box with italics (can't seem to get 1 text box to display Genus spp data in italics and Author data without italics).

So I have a text box beneath the one mentioned earlier which is:
=IIf(IsNull([Genus spp]),"",Nz([Genus spp]))

On top of that is the following:
=IIf(IsNull([Author]),"",Space(Len(nz([Genus spp]))+2) & Nz([Author]))

Is there a way to incorporate your suggestion but not have the Genus spp overwrite the lower, italicized text box?

Thanks,

Jeff
 

Users who are viewing this thread

Back
Top Bottom