Discussion Locked

Access 2000 Report Criteria Follow-up

0 helpful
4 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Follow-up after Charles' answer to this question:
Access 2000 Query Criteria on Report

In Access 2000, we added the actual SQL statement in the report footer. The report in question does reference a single data source, but is actually not based on just a single query. The data-source query selects its records both from tables and from the results of a sub-query.

With appropriate module in Access, this statement puts the SQL on the report:
=GetSQLQry([RecordSource])

Assuming a final-result query 'A' and sub-queries 'a' and 'b', what SQL or VB statement (or parameter to this one) do I need to put in a second (or third) text box to print the SQL statement of the sub-query(ies)?

4 replies

by charles byrne

Ben,

I have Access 2000 so it may be different if you're using another version (I think Access 97 referred to subforms as CHILD that was when I did alot of this). Anyway pass the subreport's name, then Form.Recordsource:

=GetSQLQry([SubReportName].Form.Recordsource)

If you don't know what the subreport name is go to the expression builder for that text box and expand your report folder to see the subreports.

It should work the same, but with microsoft, you never know.

If you have questions, you can e-mail me at work
byrnec<- AT ->dfs<-DOT->state<-DOT->fl<-DOT->us
just format the above to proper e-mail syntax (too many bots are picking up my yahoo e-mail I don't want to repeat the same mistake with my work e-mail).

Charles

This discussion is closed to new replies.