Hi all,

I have a report displays information of a sample. Within that report a subreport that displays all bags info. The problem is the subreport will not display the bags in ascending order. I tried adding ORDER BY in subreport open event by doing that subreport will not open(display). If I remove the ORDER BY the subreport opens up but not in order. I don't see any syntax problem could anyone see or tell why this is not working?
I'm using Access 2000 & SQL Server 2000.
Thanks for your assistance.

Here is my code in subreport open event:
Private Sub Report_Open(Cancel As Integer)
On Error GoTo Err_Report_Open
Dim str As String, bag_num As String

lot_n = 4214
sampling_id = 313
'''displays bags with defective parts

str = "SELECT DISTINCT dbo.tblBag_results.bag_num, dbo.tblBag_results.bag_results_id, dbo.tblBag_results.sampling_data_id, dbo.tblBag_results.lotnum, "
str = str & "dbo.tblBag_results.quantity, dbo.tblBag_results.bag_deviation, dbo.tblBag_results.deflash, "
str = str & "dbo.tblBag_results.redeflash, dbo.tblBag_results.belt_sort, dbo.tblBag_results.quick_sort, dbo.tblBag_results.inspection_100per, "
str = str & "dbo.tblBag_results.bag_scrap , dbo.tblBag_results.other, dbo.tblBag_results.disposition_instruc "
str = str & "FROM dbo.tblBag_results INNER JOIN dbo.tblRMR_desc_defects ON "
str = str & "dbo.tblBag_results.bag_results_id = dbo.tblRMR_desc_defects.bag_results_id "
str = str & "WHERE dbo.tblBag_results.lotnum = " & lot_n & " "
str = str & "AND dbo.tblBag_results.sampling_data_id = " & sampling_id & " " 'ORDER By dbo.tblBag_results.bag_num"
str = str & "ORDER By dbo.tblBag_results.bag_num"

Me.RecordSource = str

Exit_Report_open:
Exit Sub

Err_Report_Open:
MsgBox err.Description
Resume Exit_Report_open



End Sub