sorting (Using vb code)

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi:

I want my report sorted by Product code, or Product name, or product weight
....

So I build an combo box, after user selects the sorting field, the reprot
will shows that.

How to write a code for that? (I don't want to use: View menu -> Sorting &
Grouping, it is not flexiable).

I have tried:
=================================================
qryTheSupplierID = "SupplierCode = '" & Me.cmbSupplierCode & "' ORDER BY
ProductCode ; "

DoCmd.OpenReport "rptProductSummerySheet", acPreview, , qryTheSupplierID

DoCmd.Close acForm, "frmTypeSupplierCodeForProductSummary"
====================================================

Error message: Syntax wrong.

Any suggestion, thanks.

James
 
James, I didn't explain that the ORDER BY clause of the source query is not
a reliable approach.

If there is nothing in the Sorting'n'Grouping and you really don't want to
use that approach, you could set the OrderBy property of the report in
Report_Open, remembering to turn OrderByOn on as well.
 
Back
Top