Data type mismatch when passing String sort field to report

  • Thread starter Thread starter F-13
  • Start date Start date
F

F-13

I'm attempting to sort a report from one of two options offered from
an option group [frmSort] on a form [frmSumOrders].

I have added the following code to the "on open" event of the report:

Select Case Forms!frmSumOrders!frmSort
Case 1 'Job
Me.GroupLevel(0).ControlSource = "JobNo"
Case 2 'Company
Me.GroupLevel(0).ControlSource = "Companyname"
End Select

JobNo is a Long Integer, while Companyname is text. Sorting by JobNo
works, however sorting by Companyname gives me a "3464 Data type
mismatch" error message. Could anyone shed any light?

Thanks.
 
What other options have you set in the Sorting'n'Grouping box, e.g. for
Group On and Group Interval?

You could try saving the report unbound (i.e. nothing in its RecordSource).
Then in Report_Open:
Me.RecordSource = "SELECT ...
That way it has no idea what data types it should expect.
 
Back
Top