Setting OrderBy for a report in VBA

  • Thread starter Thread starter Phil Hellmuth
  • Start date Start date
P

Phil Hellmuth

I want to set the OrderBy property based upon a value in an open form.
In the Report Open event, I use the following code:

If [Forms]![FormName].[SortField] = "Field1"
me.OrderBy = "Field1"
Else
Me.OrderBy = "Field2"
Endif
Me.OrderByOn = True

Though the code executes, the report sorts no differently than if the
code didn't execute. Am I doing something wrong?

Thanks in advance.
 
Back
Top