Sort Report by variable value (1 Viewer)

NicoleM99

Registered User.
Local time
Today, 13:53
Joined
Mar 7, 2012
Messages
13
Dear All,

I have built a form that contains comboboxes allowing the user to choose what they would like to see on their report. Below is an piece of code that takes the choice of the combobox, and puts it in the report. What I need help with is how to set lblfield1/tbfield1 as the value to use for sorting the finished report. Can anyone help me out with this please?


SetReportControls Forms!CustomReport.Combo10.Value, _
Reports!rptCustom.lblField1, Reports!rptCustom.tbfield1
SetReportControls Forms!CustomReport.Combo13.Value, _
Reports!rptCustom.lblField2, Reports!rptCustom.tbfield2
SetReportControls Forms!CustomReport.Combo12.Value, _
Reports!rptCustom.lblField3, Reports!rptCustom.tbfield3
SetReportControls Forms!CustomReport.Combo15.Value, _
Reports!rptCustom.lblField4, Reports!rptCustom.tbfield4
etc, etc...

Thank you :)
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 12:53
Joined
Jul 9, 2003
Messages
16,294
I think you're going about it the wrong way, in effect painting yourself into a corner.

Let's say you successfully display the data on the report exactly how the user wants it, now the user comes back to you and says That's brilliant! Now can I export that into a spreadsheet please!

You will find yourself in this position I'm sure, and your report solution will not lend itself to exporting to excel, you will have to design an entirely new system for this new function, namely exporting the data to a spreadsheet.

You can still use the combo boxes to modify the data however instead of directly modifying the report, modify the underlying data set of the report, usually a query. Now your query becomes useful not only for the report but for anything else you want to do with the data you have extracted.
 
Last edited:

NicoleM99

Registered User.
Local time
Today, 13:53
Joined
Mar 7, 2012
Messages
13
Thanks Gizmo...I hadn't thought of that :).

I need to keep it simple though...as it is set up now, the user can print the report they design with the form. As I am dealing with a bunch of sales agents across Italy, who have even less knowledge of Access than I do :), I would prefer not to allow them too much room to manuever. My colleagues who need more detailed reports, exported into Excel, etc. know how to open the db with shift and can make their own report without using my form.

I just wanted to set formatting so that the left column is always sorted A-Z. Is there a simple way to do this?
 

Users who are viewing this thread

Top Bottom