Results 1 to 5 of 5
  1. #1
    Join Date
    Jun 2003
    Posts
    45

    Unhappy Unanswered: Sort by Expression

    Hi everyone,

    I have the following problem:

    I want to sort a report by expression. I have a field which counts number of occurrences of Client Name. It source is =Count([ClientName])
    I want to sort my report by that field. I can't use the name of the field in Sorting and Grouping window. I tried to add there the expression =Count([ClientName]) but then report doesn't work /returns blank page/.
    I tried to add a code in OnOpen Event of Report that does Sort Group Level (0) but it still doesn't work.

    I suppose that there should be a simple solution but I'm too stupid to find it :-(

    I'll appreciate any help on this.

    Thanks

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    do the count in a query rather than a control in a report, then the value int he query can be sorted in the form or report that consumes the data
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Jun 2003
    Posts
    45
    I'm not sure how to do the count in a query. Recordsource of that report is stored procedure.

  4. #4
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    so what is SQL statement executed in the stored procedure
    I'd rather be riding on the Tiger 800 or the Norton

  5. #5
    Join Date
    Jun 2003
    Posts
    45
    Select tbl1.Field1, tbl1.Field2, ... tbl1.ClientName
    From Table1 left outer Join Table2 on tbl1.Field1 = tbl2.Field1
    Where tbl1.Field2 = @Param1
    Union Select tbl1.Field1, tbl1.Field2, ... tbl1.ClientName
    From Table1 left outer Join Table3 on tbl1.Field1 = tbl3.Field1
    Where tbl1.Field2 = @Param1

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •