Hi, Im trying to group by if a value = true in a form and passes to a report and am getting "Object Required" when I attempt this.
Here is my code:
Private Sub Report_Open(Cancel As Integer)
If Forms!frmPMProjectsrptSubForm.chkcoord = True Then
Me.OrderBy = (dbo_view3.Coordinator)
Me.OrderByOn = True
End If
End Sub
Can anyone help? I need to be able to order by a 'check box' in the form (referenced above).
Thanks.
-Bob
In order for this to have a chance to work, the form has to remain open until the report is completed. So, the first thing you need verify is that you haven't closed the form before the report opens.
If the above fix does not work, I would change my approach since I don't see how ticked checkboxes (by themselves) are going to provide a sort order. Now if the ticked checkboxes results in filtering certain records to be displayed and you want the report ordered on a specific field in those records, that is a different story. In that case, the way I would do it would be to put the following criteria in the criteria row of the checkbox column in your query (record source for the report) :
Forms!frmPMProjectsrptSubForm.chkcoord = True
and then in the column in your query that you want to sort by, I would select ascending in the Sort row. Then run your report with the revised query and see if it works.