Report Sort Order

  • Thread starter Thread starter Martin
  • Start date Start date
M

Martin

Hello,

I have an option button on a form that the default value is -1. This means
the report will sort by that field. What I want to happen is the user can
click in the option button to change the value to 0 and so not sort on the
field.

However I get an error message saying the control source is incorrect.

i know you have to have the correct number of groupings for the correct
number of options buttons on the form but is there anyway for me to say
programatically is the option button is equal to 0 then no sorting or
grouping exists for that field?

Here is the code:

If Forms![FORM NAME]!FIELDNAME = -1 Then Me.GroupLevel(0).ControlSource =
"FIELDNAME" Else Me.GroupLevel(0).ControlSource = ""

Many thanks for your help.

Martin
 
Martin said:
I have an option button on a form that the default value is -1. This means
the report will sort by that field. What I want to happen is the user can
click in the option button to change the value to 0 and so not sort on the
field.

However I get an error message saying the control source is incorrect.

i know you have to have the correct number of groupings for the correct
number of options buttons on the form but is there anyway for me to say
programatically is the option button is equal to 0 then no sorting or
grouping exists for that field?

Here is the code:

If Forms![FORM NAME]!FIELDNAME = -1 Then Me.GroupLevel(0).ControlSource =
"FIELDNAME" Else Me.GroupLevel(0).ControlSource = ""


Use any constant **expression**. E.g.

.... Else Me.GroupLevel(0).ControlSource = "=1"
 
Back
Top