Sort order

L

Leslie Isaacs

I have a report that includes the fields [accounting month] in the report
header, and [actcat] and [stn3 amt] in the 'actcat' group footer.
In the report's OnOpen event I have:

Private Sub Report_Open(Cancel As Integer)
If [accounting month] = "August 2004" Then
Me.OrderBy = [stn3 amt]
Else
Me.OrderBy = [actcat]
End If
End Sub

.... but when I try to open the report I get "Runtime error 2567 You entered
an expression that has no value", and the 2nd line in the above code is
highlightes in yellow. It doesn't matter whether I am trying to view the
report when [accounting month] = "August 2004" or some other value - same
result.

Grateful for any help!

Leslie Isaacs
 
R

Rick Brandt

Leslie Isaacs said:
I have a report that includes the fields [accounting month] in the report
header, and [actcat] and [stn3 amt] in the 'actcat' group footer.
In the report's OnOpen event I have:

Private Sub Report_Open(Cancel As Integer)
If [accounting month] = "August 2004" Then
Me.OrderBy = [stn3 amt]
Else
Me.OrderBy = [actcat]
End If
End Sub

... but when I try to open the report I get "Runtime error 2567 You entered
an expression that has no value", and the 2nd line in the above code is
highlightes in yellow. It doesn't matter whether I am trying to view the
report when [accounting month] = "August 2004" or some other value - same
result.

The Open event is too soon to attempt to evaluate any values in the Report
so the test for [accounting month] will always fail.
 
Top