For a report, anything in its Sorting And Grouping dialog will override the
OrderBy property.
You can reassign the ControlSource of the GroupLevel, as shown here:
Sorting Records in a Report at run-time
at:
http://allenbrowne.com/ser-33.html
If you do want to assign the OrderBy, enclose the field names in quotes, and
don't forget to set OrderByOn. Typically this would go in the Open event of
the report:
Me.OrderBy = "[SomeField], [AnotherField]"
Me.OrderByOn = True
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users -
http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"tim otero" <ti******@msn.com> wrote in message
news:JL*********************@newssvr13.news.prodig y.com...
I should be able to figure this one out, but it's late:
I'm trying to sort a report by two fields. I can do it easily if I
hard-code the fields. However, I want to get user input and store the
input in variables, which would then be used in the OrderBy method. Right
now it looks like this and is not working:
rptMember.OrderBy = strfield1, strfield2
What am I doing wrong? Any help would be greatly appreciated.
Thank you,
tim