Report Sort Sequence Prompt

D

Dave F

I want to create a form that prompts the user for the sort sequence of a
report. I will display four pull down lists that display the available
fields. This would work similar to how the Report Wizard works when it asks
the user for the sort sequence.

How can I build a pull down list of fields that are in the query that the
report is built over?

Then can I set the group level in the report open event with the value from
the pull down list?
Such as:
Me.GroupLevel(0).ControlSource = SortSeq0
Me.GroupLevel(1).ControlSource = SortSeq1
Me.GroupLevel(2).ControlSource = SortSeq2
Me.GroupLevel(3).ControlSource = SortSeq3

Thanks,
Dave F
 
M

Marshall Barton

Dave said:
I want to create a form that prompts the user for the sort sequence of a
report. I will display four pull down lists that display the available
fields. This would work similar to how the Report Wizard works when it asks
the user for the sort sequence.

How can I build a pull down list of fields that are in the query that the
report is built over?

Then can I set the group level in the report open event with the value from
the pull down list?
Such as:
Me.GroupLevel(0).ControlSource = SortSeq0
Me.GroupLevel(1).ControlSource = SortSeq1
Me.GroupLevel(2).ControlSource = SortSeq2
Me.GroupLevel(3).ControlSource = SortSeq3


If the report's Record Source is a table or a saved query
(not an SQL statement), then you can check the Fields
collection of the TableDef or QueryDef.

For Each fld In CurrentDb.TableDefs!nameoftable.Fields
strFieldList = strFieldList & "," & fld.Name
Next
Me.Combo1.RowSource =Mid(strFieldList, 2)
 
D

Dave F

Purhaps, but I was looking for a more dynamic way of building the list.

Thanks,
Dave

Duane Hookom said:
Couldn't you use a combo box with a Row Source Type of Field List?
 
D

Dave F

Your right.
I overlooked the obvious.
This way is much easier.

Thanks,
Dave F


Duane Hookom said:
Couldn't you use a combo box with a Row Source Type of Field List?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top