B
BCP
I have added the following code to override the recordset for a report. The
problem is despite the fact that there is no Record Source defined and I can
prove that the override of the Recordset is working the data in the report is
not sorting per the Sort Order in the SQL.
IForms![FrmVariedSortExample]![SortPullDown] is in the report header and is
being moved in properly. When I use Debug to pull the recordset and copy it
into the SQL of a query it works fine and sorts correctly. The report was
built with Order By On set to No and the Sorting and Grouping is completely
empty/Blank.
Private Sub Report_Open(Cancel As Integer)
Dim db As Database, sql As String
sql = "SELECT TblVariedSortExample.ApprovalCAT, " _
& "TblVariedSortExample.Division, " _
& "TblVariedSortExample.DivisionName, " _
& "TblVariedSortExample.SVP, " _
& "TblVariedSortExample.Controller, '" _
& Forms![FrmVariedSortExample]![SortPullDown] & "' AS SortOrder " _
& "FROM TblVariedSortExample " _
& "ORDER BY TblVariedSortExample." &
Forms![FrmVariedSortExample]![SortPullDown] & ";"
Me.RecordSource = sql
End Sub
Any suggestions will be greatly appreciated - BCP.
problem is despite the fact that there is no Record Source defined and I can
prove that the override of the Recordset is working the data in the report is
not sorting per the Sort Order in the SQL.
IForms![FrmVariedSortExample]![SortPullDown] is in the report header and is
being moved in properly. When I use Debug to pull the recordset and copy it
into the SQL of a query it works fine and sorts correctly. The report was
built with Order By On set to No and the Sorting and Grouping is completely
empty/Blank.
Private Sub Report_Open(Cancel As Integer)
Dim db As Database, sql As String
sql = "SELECT TblVariedSortExample.ApprovalCAT, " _
& "TblVariedSortExample.Division, " _
& "TblVariedSortExample.DivisionName, " _
& "TblVariedSortExample.SVP, " _
& "TblVariedSortExample.Controller, '" _
& Forms![FrmVariedSortExample]![SortPullDown] & "' AS SortOrder " _
& "FROM TblVariedSortExample " _
& "ORDER BY TblVariedSortExample." &
Forms![FrmVariedSortExample]![SortPullDown] & ";"
Me.RecordSource = sql
End Sub
Any suggestions will be greatly appreciated - BCP.