10 replies
by walkerxp92
by chandraram
by walkerxp92
Not quite what I am looking for... I do know how to choose what to sort but I want to make parameter field that will allow me to choose what column I want to sort by.
by chandraram
by walkerxp92
column in the report... exp: I have a report that pulls 8 columns from sql and 4 of those I want to sort by but not at the same time, I want the report to have a parameter select field in the beginning that asks the user running the report to choose which column to sort by.
by regg
>Not quite what I am looking for... I do know how to choose what to sort but I want to make parameter field that will allow me to choose what column I want to sort by.<
But this is what you asked for and the given answer is correct.
If the user selects on your form grid a certain column, then:
TheFieldName = DataGrid1.Columns(DataGrid1.Col).DataField
or
TheFieldName = DataGrid1.Columns(DataGrid1.SelStartCol).DataField
then you pass that column to CR as a sort parameter.
If you are using the OCX then that would be, just as already given:
CrystalReport1.SortFields(0) = "+{" & TheTableName & "." & TheFieldName & "}"
Because SortFields is an array make sure you you clear any other defined sort parameters (i.e. in a previous printing the sort parameter may have 2 fields defined under SortFields(0) and SortFields(1). If you do not clear SortFields(1)="" then it remains as previously defined. You can also use the Reset method to clear all)
by walkerxp92
Poster rated this answer.
by chandraram
by walkerxp92
Poster rated this answer.
by walkerxp92
This discussion is closed to new replies.
Trending Software posts
Sort by Trending