Eljefegeneo
Still trying to learn
- Local time
- Yesterday, 18:53
- Joined
- Jan 10, 2011
- Messages
- 902
I would like to set the sorting on a report with vba. I know that I can do this via the OnOpen event with code something like:
But want I want do to is set the sOrder from a button on another form from which I open the report. If I set the string for sOrder from an OnClick event to open the report, it doesn't pass to the next event. What I tried was:
I hope I am missing something that is obvious, but I just cannot figure out what to do.
Code:
Dim sOrder As String
sOrder = "[DateOfContact] Asc"
Me.OrderBy = sOrder
Me.OrderByOn = True
Code:
Dim sOrder As String
sOrder = "[DateOfContact] Asc"
DoCmd.OpenReport "rptSalesFollowupPreviousAll2", acViewReport