Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trying to put two strings together for a Label 1

Status
Not open for further replies.

barbette

Technical User
Nov 13, 2006
2
US
It seems like this would be simple, but I can't seem to make it work.

I have a student database and I'm trying to creat labels that include only the student's first name and their last initial. It would seem to make sense that I could use the =TRIM expression to remove the extra spaces int eh first name, then use the =LEFT expression to get the student's initial of her last name. I tried:

=TRIM([FirstName]& " " (=LEFT([LastName],1)))

but I get an expression error. Apparently you can't nest the expressions. I tried it without the additional () but Access didn't like that either.

I also tried by making a text box for the firt name only, then the last initial in a separate text box. The right data prints out, but the last initial is not aligned next to the first name. I have CanShrink and CanGrow = Yes, but if the text box isn't the right size, it doesn't work.

Can anyone help? How can I get the two pieces of data to print out like "Barbette B"??

I've onky been using Access for a few months, but I've figured out most everything else I need. This one has stumped me.

Thanks! Barbette
 
You have too many 'equals', among other things. It is often a good idea to use the expression builder:

[tt]=TRIM([FirstName]) & " " & LEFT([LastName],1)[/tt]
 
Trim() should not be necessary in most systems since trailing spaces are not saved in Access tables. One "gotcha" that often trips us up is the text box name must not be the name of a field in your report's record source.

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Perfect! I was making it much more difficult...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top