
May 14th, 2004, 06:34 PM
|
|
Registered User
|
|
Join Date: May 2004
Location: Lisle, IL
Posts: 1
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
Sorting records in a sub-report
Let's say I have a fleet of cars and each car has maintenance events such as oil changes, brakes and
so forth. I want to produce a report (MS Access 2000 as client with SQL Server 7)
that lists all the cars in my fleet. For each car in the report, I also want
a sub-report showing the maintenance actions applied to a given car. I can do this now using a
primary form with an imbedded subform, linking the
car ID between the parent/child reports. This works great when I use a view. The problem is that I would like to sort
the records in the sub-report by the Date field. SQL server does not support the ORDER BY clause in
views. The "Order By" and "Order By On" property for the subform does not sort the records when the form is
acting as a sub-report. If I run the sub-report by itself (not as a sub-report) then the sorting works. I then tried a stored procedure, which does support the ORDER BY clause, as my record source
for the sub-report. When I run this, the entire set of maintenance records is shown for each car. It seems that
the parent/child linking field is being ignored. I am beginning to conclude that SQL server does not fully support
sub-reports when the record source is a stored procedure. I have looked in my reference books and online and am unable
to find a clearly written statement that says that I cannot use a stored procedure for something like this. Sorting
the records in a sub-report seems like a reasonable thing to do. Does SQL server not support someting like this? I am open to suggestions. Thanks for your help.
Jim
|