none
Set Report Orderby from the form.orderby that opened the report RRS feed

  • Question

  • Private Sub Report_Open(Cancel As Integer) Me.OrderBy = Forms!frm_qumu_01!frm_Qumu_02.Form.OrderBy Me.OrderByOn = True Me.Filter = Forms!frm_qumu_01!frm_Qumu_02.Form.Filter Me.FilterOn = True End Sub

    This code works great for the Filter, but the Orderby does not work.  The record source is a query and I removed the sort from the query and from the report.  Can anyone please help me.  Thanks

    chris beardsley

    Tuesday, October 27, 2015 5:40 PM

Answers

  • Answer was a corrupt report!  I created a new report and just copied the columns and headers from the original report and it worked!  Thanks All for your input

    chris beardsley

    • Marked as answer by cmbeards Wednesday, October 28, 2015 4:02 PM
    Wednesday, October 28, 2015 4:02 PM

All replies

  • Hi chris Beardsley,

    Based on the test, I can order by the report using Report.Orderby in report open event. To narrow down this issue, I suggest that you debug the code to see all the value set correctly after the code below run.

    If you still have the problem, would you mind sharing a demo database to help us narrow down this issue?

    Regards & Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, October 28, 2015 6:42 AM
    Moderator
  • Hello Chris,

    I did not see any issue with your code. It would surely work as long as "frm_Qumu_02" is sorted. You can check whether it is sorted or not by using this code.

    If Forms!frm_qumu_01!frm_Qumu_02.Form.OrderBy = "" Then
    MsgBox "You need to sort first the form."
    Else
    Me.OrderBy = Forms!frm_qumu_01!frm_Qumu_02.Form.OrderBy
        Me.OrderByOn = True
    End If

    If the MsgBox pops up, it means the form is not sorted. And so, try to sort the form first and open the report again.



    Dr. Mindweb

    Wednesday, October 28, 2015 8:33 AM
  • does your report already have a sort property set in the group & sort feature?
    Wednesday, October 28, 2015 12:33 PM
  • thank you all for your answer, so let me clear up your questions:  Neither the report or query used in the report have filters or groups applied.  I am going to try and recreate the report and try again, but so far nothing has helped.  Like I stated before the filter works fine, it is just the order by. Also I used a debug statement to make sure that the order is being captured and passed correctly and it is.

    Thanks for help, but we still have a little more to accomplish here.

    CB


    chris beardsley

    Wednesday, October 28, 2015 3:33 PM
  • please see response I just posted above

    chris beardsley

    Wednesday, October 28, 2015 3:36 PM
  • Answer was a corrupt report!  I created a new report and just copied the columns and headers from the original report and it worked!  Thanks All for your input

    chris beardsley

    • Marked as answer by cmbeards Wednesday, October 28, 2015 4:02 PM
    Wednesday, October 28, 2015 4:02 PM