Setting OrderBy for a report in VBA

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top