I want to sort on an expression made of two columns of string values.
Trim(PurchaseOrderType) + trim(PurchaseOrderNumber)
How do I do this in the Report Design tool?
![]() |
Patch reliability is unclear. Unless you have an immediate, pressing need to install a specific patch, don't do it. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Back in Access (Access 97)
Kevin,
You can sort/group on an expression, but as Mark pointed out, a Null will cause you problems the way you have it typed. Try this instead:
Nz(Trim([PurchaseOrderType]),””) & Nz(Trim([PurchaseOrderNumber],””)
You don’t want a group header/footer, I assume, so make sure those are turned off. The default sort is Ascending, so you don’t need to change that unless you want to, and I recommend you not change it since descending is far slower.
Thanks to all.
BTW, there’s no Nz() function in 97, is there?
If I wanted to created a control (a calculated field) that contains these two fields concatenated, how would I do that?
I tried slapping a text control onto the report and pasting in concatenated column names, but it did work.
Actually, I think the Nz() function has been around since either Access 2 or Access 95. Try it and see if you get an error in a query grid.
If you want to concatenate two fields it is simply
MyString = [myTable].[Field1] & [myTable].[Field2]
Of course you can get cute and put in a separator character or characters.
Ok, that’s good.
MyString = [myTable].[Field1] & [myTable].[Field2]
Now what I need is to be able to put MyString in a header band of a report using the Report Design tool (or whatever it’s called) so that I can break (group) on the value of MyString. I want to do this without having to write any code.
I use Access so infrequently, if I ever knew how to do this, I have forgotten. Appreciate the help.
Char,
Ok, that’s very helpful. It works just fine. Thanks.
Now, without writing any code, I want [Field1] & [Field2] to display in the group header. I am doing this now simply by dropping both fields onto the Group header grid. But I was hoping I could create a single field or variable or calculated field or whatever (in the report, not in the DB table) that concatenates the two fields. Then I would drop that field onto the grid.
This is probably so simple, but nothing I try works. Thanks for helping.
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.
Notifications