adding underscore _ in output field

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need to add an underscore in a field that currently has a space. ie:
Name: John Smith need to output to a report to read John_Smith. Basically
replace the space with _ . Only in the report, I don't want to change the
data. Any Suggestions.
 
Assuming those names are in separate fields (which they should be), build an
unbound text field like...

=[FirstName] & "_" & [LastName]
 
I need to add an underscore in a field that currently has a space. ie:
Name: John Smith need to output to a report to read John_Smith. Basically
replace the space with _ . Only in the report, I don't want to change the
data. Any Suggestions.

Your comment ..
"Only in the report, I don't want to change the data. "
can be interpreted several ways.

You don't wish to change the Stored data in the table, or you don't
want to change the data in the report?
You have to change something somewhere.

When you decide what and where, you can use the replace function:

=Replace([NameField]," ","_")

either in an Update query to change the data stored in the table, or
in an unbound control on the report to just display the name with an
underscore, leaving the table data as is.

But you really should not be storing the full name in the table
anyway.
Store the Last Name and First Name as separate fields. Then it easy to
put them together in your report (or anywhere else):
=[FirstName] & "_" & [LastName]
 
Unfortunately they're not.

Rick B said:
Assuming those names are in separate fields (which they should be), build an
unbound text field like...

=[FirstName] & "_" & [LastName]

--
Rick B



John C. said:
I need to add an underscore in a field that currently has a space. ie:
Name: John Smith need to output to a report to read John_Smith. Basically
replace the space with _ . Only in the report, I don't want to change the
data. Any Suggestions.
 
John,
Try...
=Left(YourFieldName,InStr(YourFieldName," ")-1) & "_" &
Mid(YourFieldName,InStr(YourFieldName," ")+1)
BUT... all your fields must have just a FirstName, a space, and a
LastName.
 
Back
Top