HELP!! Need to have report sorted with Drop Down

  • Thread starter Thread starter jeditig
  • Start date Start date
J

jeditig

Guest
Okay, very simple concept yet i cant figure out how to do it. I have one table. I want to have the use be able to use a drop down box on a generic form "welcome screen" to select which field (column) he or she wants to sort by. Then click a button which opens a report based on that table and is sorted by the field the user selected.

I made the "Field List" selection box based on the table. And in the report, I entered the path to that table in the OrderBy property field. i made sure OrderBy was selected to on.

This does not work, the report will not sort. My table has about 55 fields and I dont want to create queries for each one so the user can sort.

I am stumped, anyone, please help, there has to be a way to do this, why else would you create a "field list". -- jason
 
Order by for report

I assume you have tried to set Orderby at design time of report.Instead it can be done prgrammatically from generic form.Try the following code in the after update event of the dropdown
dim strSQL as string
'strSQL is the record source of your report
strSQl="Select [field1],[field2] from Yourtable"
''The dropdown where user selects the sortorder is named cbosortby
strSQL = strSQL & strFieldList & " FROM " & Me!cboTable
strSQL = strSQL & " ORDER BY " & Me.CboSortby
Hope this helps
vengsiva
 

Users who are viewing this thread

Back
Top Bottom