String Function

  • Thread starter Thread starter OldManEd
  • Start date Start date
O

OldManEd

I have a report with ['LastName] as a field from the source table/query.

I want to follow it with a ", " before concatenating another field. Also, I
want trailing spaces, if any, removed.

I tried =RTrim([LastName]) & ", "
I also tried =LastName & ", "

..Both don't work. What will?

The field size in the underlying table is 50 characters. Are there always
trailing characters to make the whole field 50 characters or is the field
value its length?

Thanks.
OMEd
 
One more note, you have to ensure that your control is not named the same as
your control source (field name). Typically, when you create your basic
control from the field list it will have been associated/attributed the name
of the field as the name of the control. This will cause a problem when you
then try to do as you are trying to do. So simply rename the control to
another name and then enter your control source, like

=Trim([LastName]) & ", "
--
Hope this helps,

Daniel Pineault
http://www.cardaconsultants.com/
For Access Tips and Examples: http://www.devhut.com
Please rate this post using the vote buttons if it was helpful.



Daniel Pineault said:
OldManEd,

The basic synthax for your controlsource would be like

=[Salut] & " " & [First] & " " & [Last]
--
Hope this helps,

Daniel Pineault
http://www.cardaconsultants.com/
For Access Tips and Examples: http://www.devhut.com
Please rate this post using the vote buttons if it was helpful.



OldManEd said:
I have a report with ['LastName] as a field from the source table/query.

I want to follow it with a ", " before concatenating another field. Also, I
want trailing spaces, if any, removed.

I tried =RTrim([LastName]) & ", "
I also tried =LastName & ", "

..Both don't work. What will?

The field size in the underlying table is 50 characters. Are there always
trailing characters to make the whole field 50 characters or is the field
value its length?

Thanks.
OMEd
 
Thanks, this may be the problem. Will check. Meanwhile, I went into the
source query and added ( & ", ") to the lastname field and gave it another
name.

Ed


Daniel Pineault said:
One more note, you have to ensure that your control is not named the same
as
your control source (field name). Typically, when you create your basic
control from the field list it will have been associated/attributed the
name
of the field as the name of the control. This will cause a problem when
you
then try to do as you are trying to do. So simply rename the control to
another name and then enter your control source, like

=Trim([LastName]) & ", "
--
Hope this helps,

Daniel Pineault
http://www.cardaconsultants.com/
For Access Tips and Examples: http://www.devhut.com
Please rate this post using the vote buttons if it was helpful.



Daniel Pineault said:
OldManEd,

The basic synthax for your controlsource would be like

=[Salut] & " " & [First] & " " & [Last]
--
Hope this helps,

Daniel Pineault
http://www.cardaconsultants.com/
For Access Tips and Examples: http://www.devhut.com
Please rate this post using the vote buttons if it was helpful.



OldManEd said:
I have a report with ['LastName] as a field from the source
table/query.

I want to follow it with a ", " before concatenating another field.
Also, I
want trailing spaces, if any, removed.

I tried =RTrim([LastName]) & ", "
I also tried =LastName & ", "

..Both don't work. What will?

The field size in the underlying table is 50 characters. Are there
always
trailing characters to make the whole field 50 characters or is the
field
value its length?

Thanks.
OMEd
 
Back
Top