Sort a Report on an Unbound control?

L

Lee Wallander

How do I sort a report on an unbound control? I have
tried typing in the name (i.e. Reports!ReportName!
ControlName) in the Sorting and Grouping dialog. I've
also tried to use the OrderBy/OrderByOn properties
(OrderBy = "Reports!ReportName!ControlName ASC" and
OrderBy = True).

Any help would be much appreciated.
 
B

Bill Crawford

HI:

1) Make a form with the unbound field(s) for your input.
2) in your query under the field criteria make reference do this/these
unbound field(s) on the form

example: if the query fieldname is [Date] and you want to select a range
from a form named 'dateselect' with two unbound fields called [begindate]
and [enddate], add this criteria to the [Date] field in the query.

between form![dateselect]![begindate] and form![dateselect]![enddate]


any help? :)
 
R

Rick Brandt

Lee Wallander said:
How do I sort a report on an unbound control? I have
tried typing in the name (i.e. Reports!ReportName!
ControlName) in the Sorting and Grouping dialog. I've
also tried to use the OrderBy/OrderByOn properties
(OrderBy = "Reports!ReportName!ControlName ASC" and
OrderBy = True).

Any help would be much appreciated.

You don't sort on "controls". You sort on the field or expression contained in
their ControlSource.
 
L

Lee Wallander

Bill:

I do not have a pre-defined group of items. Here is what
I am trying to do.
My report has it's associated query/control source. I am
using 2 of the fields on the report from the
query/control source. I am getting a third field from a
function which uses 1 of the 2 fields from the query as
the "WHERE" clause in the SQL within the function. The
value that is returned from the function is the field I
want to sort by. The value being returned by the
function is correct. When I run the report, it displays
the three fields I want, but it does not sort it
properly. I am assuming I can sort the report on any
column irregarless if it is part of the query/control
source or unbound, but I cannot find the proper "syntax"
to do the sort.
This is my latest stab at it.

Private Sub Report_Open(Cancel As Integer)
Me.OrderBy = "=[Reports]![ELOU]![CompanySubTicker] DESC"
Me.OrderByOn = True
End Sub

CompanySubTicker is the Name of the 3rd report field.
Removing the "=" does not help any.

I have tried so many combinations of values in the
Field/Expressions drop down on the Sorting and Grouping
dialog that I do not even know what I have or have not
tried anymore.

Here is a sample of my output from the report.
Again, I want to sort by the 3rd column.

Computer Associates Int'l 1500 CA-01
AAR Corp 2000 AIR-01
Boeing Company 1500 BA-01
Alltel Corp 1000 AT-01

Thanks.

Lee W.
-----Original Message-----
HI:

1) Make a form with the unbound field(s) for your input.
2) in your query under the field criteria make reference do this/these
unbound field(s) on the form

example: if the query fieldname is [Date] and you want to select a range
from a form named 'dateselect' with two unbound fields called [begindate]
and [enddate], add this criteria to the [Date] field in the query.

between form![dateselect]![begindate] and form! [dateselect]![enddate]


any help? :)


Lee Wallander said:
How do I sort a report on an unbound control? I have
tried typing in the name (i.e. Reports!ReportName!
ControlName) in the Sorting and Grouping dialog. I've
also tried to use the OrderBy/OrderByOn properties
(OrderBy = "Reports!ReportName!ControlName ASC" and
OrderBy = True).

Any help would be much appreciated.


.
 
B

Bill Crawford

HI:

Type the expression or fieldname for that 3rd field into the sorting and
grouping window and select the sort order. You may have to fiddle with the
sequencing of this field or expression in the grouping list for proper
results.

work?



Lee Wallander said:
Bill:

I do not have a pre-defined group of items. Here is what
I am trying to do.
My report has it's associated query/control source. I am
using 2 of the fields on the report from the
query/control source. I am getting a third field from a
function which uses 1 of the 2 fields from the query as
the "WHERE" clause in the SQL within the function. The
value that is returned from the function is the field I
want to sort by. The value being returned by the
function is correct. When I run the report, it displays
the three fields I want, but it does not sort it
properly. I am assuming I can sort the report on any
column irregarless if it is part of the query/control
source or unbound, but I cannot find the proper "syntax"
to do the sort.
This is my latest stab at it.

Private Sub Report_Open(Cancel As Integer)
Me.OrderBy = "=[Reports]![ELOU]![CompanySubTicker] DESC"
Me.OrderByOn = True
End Sub

CompanySubTicker is the Name of the 3rd report field.
Removing the "=" does not help any.

I have tried so many combinations of values in the
Field/Expressions drop down on the Sorting and Grouping
dialog that I do not even know what I have or have not
tried anymore.

Here is a sample of my output from the report.
Again, I want to sort by the 3rd column.

Computer Associates Int'l 1500 CA-01
AAR Corp 2000 AIR-01
Boeing Company 1500 BA-01
Alltel Corp 1000 AT-01

Thanks.

Lee W.
-----Original Message-----
HI:

1) Make a form with the unbound field(s) for your input.
2) in your query under the field criteria make reference do this/these
unbound field(s) on the form

example: if the query fieldname is [Date] and you want to select a range
from a form named 'dateselect' with two unbound fields called [begindate]
and [enddate], add this criteria to the [Date] field in the query.

between form![dateselect]![begindate] and form! [dateselect]![enddate]


any help? :)


Lee Wallander said:
How do I sort a report on an unbound control? I have
tried typing in the name (i.e. Reports!ReportName!
ControlName) in the Sorting and Grouping dialog. I've
also tried to use the OrderBy/OrderByOn properties
(OrderBy = "Reports!ReportName!ControlName ASC" and
OrderBy = True).

Any help would be much appreciated.


.
 

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