Data type mismatch when passing String sort field to report

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.
 
A

Allen Browne

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top