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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to create sort expression 2

Status
Not open for further replies.

Watermelon

Programmer
Apr 16, 2001
68
US
Hi,

Can anyone help me? I'm trying to create an expression to sort my report on (under View/Sorting and Grouping). Basically, I want my report to sort by Last and First Name. These are separate fields in my table so I'm assuming the best way to use them as a sort on the report is by creating this expression?

I looked at Access help and the examples there weren't very good. That's why I'm posting here.

Thanks for any help.

WM
 
I don't think that you need to group by an expression field. You set an outer group to the LastName field and right under that insert a group for the FirstName field. Then in the FirstName Group Header you can insert a text box with your expression: =[LastName] & ", " & [FirstName].

-Gary
 
I would use just one sorting level for this and use the expression:
=LastName & FirstName
Make sure you include the "=".

Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
Thanks, guys. I like your suggestion Duane. I'll give this a try tomorrow and let you know.

Thanks,

WM
 
WM -

Regardless of the reporting tool that you use, you are setting yourself up to get burned with the logic that you are attempting to use. If you have more than one Tom Smith, for instance, they will all get grouped together. An alternative would be to group by the field that uniquely identifies people in your table. Then concatenate the first and last names in a field that is displayed at this group level.

Duane -

It had never occurred to me that I might be able to group by expression fields in Access. Thanks for another useful tidbit of info!

-Gary
 
glalsop,
Great point on the issue of possible duplicate names.

Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
Duane,

That was great help. Worked like a charm. Thanks so much! And, Gary good tip as well.

Thanks,

WM
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top