evenlater,
ok, so i think the thing that we have to get our heads around here is
that there is no way to identify the selected fields in a recordsource
without first opening the report. so, i would abandon this way of
thinking altogether and start to get my head around a different way to
accomplish the same objective; i.e., give the user report specific
options for sort orders.
good news is that there are a few ways to do this:
1. build a new screen for each report that has the various sorts. as i
mentioned earlier, i use a series of 5 combo boxes, each combo box is
source via a value list which you can type into the properties (e.g.,
"Category"; "Type"; "Location") . you can also do some tricky stuff
with an ascending / descending button next to the combo box which i
like alot. from here, you can write some code that looks alot like the
code i put above in my earlier post.
2. create a single screen for all report with a predefined number of
sorts, e.g., 5. then you can use your code to populate the recordtype
(i think) and recordsource of the combo box with report specific sort
criteria. an example might look like:
Select Case strReportName
Case rptOne
me.cboOne.RowSo urceType = "Value List"
me.cboOne.RowSo urce = "Category"; "Type"; "Location"
Case ...
End Select
This code would go in the Form_Load event
3. create a table (similar to Albert's suggestion) with all of the
report names and their related sort fields. you'll have to do some
research on counting the number of sortable fields, then "drawing" the
related combo boxes, etc... i think this would perhaps be the hardest
way to go about what you are thinkgin of doing.
Hope this helps,
Kelii
ok, so i think the thing that we have to get our heads around here is
that there is no way to identify the selected fields in a recordsource
without first opening the report. so, i would abandon this way of
thinking altogether and start to get my head around a different way to
accomplish the same objective; i.e., give the user report specific
options for sort orders.
good news is that there are a few ways to do this:
1. build a new screen for each report that has the various sorts. as i
mentioned earlier, i use a series of 5 combo boxes, each combo box is
source via a value list which you can type into the properties (e.g.,
"Category"; "Type"; "Location") . you can also do some tricky stuff
with an ascending / descending button next to the combo box which i
like alot. from here, you can write some code that looks alot like the
code i put above in my earlier post.
2. create a single screen for all report with a predefined number of
sorts, e.g., 5. then you can use your code to populate the recordtype
(i think) and recordsource of the combo box with report specific sort
criteria. an example might look like:
Select Case strReportName
Case rptOne
me.cboOne.RowSo urceType = "Value List"
me.cboOne.RowSo urce = "Category"; "Type"; "Location"
Case ...
End Select
This code would go in the Form_Load event
3. create a table (similar to Albert's suggestion) with all of the
report names and their related sort fields. you'll have to do some
research on counting the number of sortable fields, then "drawing" the
related combo boxes, etc... i think this would perhaps be the hardest
way to go about what you are thinkgin of doing.
Hope this helps,
Kelii