Can anybody see why the following code doesn't work. VB.Net doesn't grumble but it doesn't run the report and promptly exits the program without any errors. If I comment out the code it works fine.

The report already has two sort fields but I just need to change the sort order.

VB Code:
  1. Dim sField1 As CrystalDecisions.CrystalReports.Engine.DatabaseFieldDefinition
  2. sField1 = x.cr.Database.Tables.Item(0).Fields("sales_order")
  3. x.cr.DataDefinition.SortFields.Item(0).Field = sField1