Discussion Locked

Access Database

0 helpful
6 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
How can I create a report that will sort by the first letter of a last name? For example all C's will go under the heading C.The form I have inputs the whole last name, how do I get it to look at just the first letter?Thanks

6 replies

by m_ozog

This is fairly simple - hard to find in the beginning.

1) When you have your report open in design mode, selct Sorting and Grouping.

2) Select the field you want sorted by the 1st character.

3) Select the "Group On" and change it to Prefix Characters.

4) Then change Group Interval if you want more than the 1st character.

by peyison

From the Sorting and Grouping option, first select the field to sort on (LastName). Then set the folowing:

Group Header = Yes
Group On = Prefix Characters

Then, in the Header for LastName, add a textbox. Set the textbox's Control Source property to:

=Left([LastName],1) (replace LastName with the actual name of your field)

Should be good to go.

Hope this helps.

by bob sellman

I'd suggest using a query as the source for the report, if you haven't already.

Add this column to the query:
FirstLetter: Left$([LastName],1,1)

(LastName should be the name of your last name column.)

I suspect that you still want your report sorted by the entire last name (and possibly also the first names). So you should set up the following sorting/grouping in your report:

FirstLetter
LastName
FirstName

Set it up so there is no header or footer for the LastName and the First Name.

Set up FirstLetter so it has at least a header. In that header you can then print the letter.

By doing the report this way you can show the letter before each set of names, but the entire list of names will be sorted alphabetically.
I think that it's a lot cleaner to use the query as the place to define the first letter of the last name, as opposed to defining an object on the report. Also makes sorting easier (and probably faster).

This discussion is closed to new replies.