That will error if chrLastName is more than 13 characters long or if
chrLastName is Null.
You might try the following which should work to always return 13 characters
LEFT( [dbo_Pr_EmpDemo_T]![chrLastName] & Space(13),13)
You could also write yourself a simple vba function that would take two
parameters.
Public Function PadString(StrIn as variant, HowLong as Integer) as String
'Add Spaces to end
PadString = Left(StrIn & Space(HowLong),HowLong)
End Function
You could also add spaces to the start with the following
Public Function PadStringStart(StrIn as variant, HowLong as Integer) as
String
'Add Spaces to Beginning
PadString = Right(Space(HowLong) & StrIn,HowLong)
End Function
jjacob said:
my forumla looks like this
LastName: [dbo_Pr_EmpDemo_T]![chrLastName] &
Space(13-Len([dbo_Pr_EmpDemo_T]![chrLastName]))
and I am getting an error that it's too complex to be evaluated.
Klatuu said:
The opposite of trim is mirt, which on my home planet of Tralfamadore,
translates to Space, so you can use the Space function:
= LastName & Space(15 - Len(LastName))
= FirstName & Space(15 - Len(FirstName))
jjacob said:
I'm not really being clear and I apologize for that.
The fields are
LastName
FirstName
and more
Not all last names are going to be 5 characters. But the field needs
to be
a static 15 characters so that when I transfer it out to a text file I
get a
15 character field, not a 5 character field with the next one right
after.
So like this
Jacob Julie
:
assuming jacob is in one field and (end) is in another just text
You could
use [field]&" "&"[field2]
:
I am familiar with the trim command to drop extra spaces in a data
field when
joining 2 fields. But I am trying to create a table that acutually
inserts
blanks or spaces so that ifwe normally see
Jacob(end)
I want to see
Jacob (end) with 5 extra spaces
Thanks.