Report RecordSource

S

Simon Harris

Hi All,

I am running the following code, fired from the onopen event of a report:

Private Sub Report_Open(Cancel As Integer)
'Set the recordsource for the report so it matches the customer listbox
rowsource
Reports!RPT_currently_viewed_customers.RecordSource =
Forms!Frm_switchboard!CustomerReportSQLStorage.Value
MsgBox (Reports!RPT_currently_viewed_customers.RecordSource)
End Sub

Forms!Frm_switchboard!CustomerReportSQLStorage is populated from the onclick
event of a button on my form - This takes the rowsource of a list box and
places it in the test box (Chunk of SQL)

The report opens AOK, with the expected data, But...the records are not
ordered correctly, e.g. The data I see in the report does not respect the
ORDER BY clause in the SQL.

Could it be that the report has an order by property?? Or something else
going on here??

Would appreciate any help that may be offered.

Thanks for reading!

Simon.

--
-
* Please reply to group for the benefit of all
* Found the answer to your own question? Post it!
* Get a useful reply to one of your posts?...post an answer to another one
* Search first, post later : http://www.google.co.uk/groups
* Want my email address? Ask me in a post...Cos2MuchSpamMakesUFat!
 
S

Simon Harris

Just looked at the reports properties:

Record Source, Filter, 'Filter On', 'Order By' and 'Order By On' are all
empty.

Hmmmm.....wot now? :)
 
D

Dirk Goldgar

Simon Harris said:
Hi All,

I am running the following code, fired from the onopen event of a
report:

Private Sub Report_Open(Cancel As Integer)
'Set the recordsource for the report so it matches the customer
listbox rowsource
Reports!RPT_currently_viewed_customers.RecordSource =
Forms!Frm_switchboard!CustomerReportSQLStorage.Value
MsgBox (Reports!RPT_currently_viewed_customers.RecordSource)
End Sub

Forms!Frm_switchboard!CustomerReportSQLStorage is populated from the
onclick event of a button on my form - This takes the rowsource of a
list box and places it in the test box (Chunk of SQL)

The report opens AOK, with the expected data, But...the records are
not ordered correctly, e.g. The data I see in the report does not
respect the ORDER BY clause in the SQL.

Could it be that the report has an order by property?? Or something
else going on here??

Would appreciate any help that may be offered.

Thanks for reading!

Simon.

Is there any sorting and grouping in the report? If so, that will
override the OrderBy clause of the query.
 
S

Simon Harris

Hi Dirk,

Yup - Sorting was on, removed this and it worked as expected. Many thanks
for your reply, much appreciated.

Regards,

Simon.
 

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