Open a report and set Orderby

ktrasler

Registered User.
Local time
Today, 08:37
Joined
Jan 9, 2007
Messages
39
Hi

How do I open a report and set the Orderby property.

Code:
DoCmd.OpenReport "rptColleagueByTeam", acViewPreview, "qryColleagues", "[Shift]='" & strshift & "'"

Here is the code that opens my report, now I want to sort by 'TLsurname'

I thought I would just be able to add the order by on at the end of the docmd string but can't get it to work.

What I have found is the following

Me.GroupLevel(0).ControlSource = "[TLSurname] & ' ' & [TLForename]"
Me.GroupLevel(0).SortOrder = 0


This does work but can it be done in the docmd string.

Cheers

Kev

P.S. Don't want to waste anyones time as I have found a solution, just not sure its the best one.
 
To my knowledge it can't be done within the OpenForm arguments. I do that type of thing in the open event of the report (but only if it's dynamic, where the user is selecting how they want it sorted).
 

Users who are viewing this thread

Back
Top Bottom