Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sub report question

Status
Not open for further replies.

sjh

Programmer
Oct 29, 2001
263
US
I have a city-level report which I want to include in my state-level report.

So when user selects a state, (i.e. PA), then it should display the city-level report for all the cities in Pennsylvania.

I am having trouble designing the state-level report. Should I base the report on a query? I get this error message --> 'you can't set the Record source property in print preview or after printing has started'.

Please help!!!

Thank you,
SJH
 
Apparently you are attempting to run some code. Would you mind sharing the code and the reason for using it?

Duane
MS Access MVP
[green]Ask a great question, get a great answer.[/green]
[red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
[blue]Ask me about my grandson, get a grand answer.[/blue]
 
There was a bogus code in the Report Open event, which I removed and I no longer get the error message.

I don't know how to link the main report and sub report together.

The source query for the main report is:
SELECT distinct cityID from cities where state = 'PA';

And the source for the sub report is:
SELECT * FROM cities WHERE state = 'PA' and cityID = '???''

How should I set the source for the sub report so that the cityID from the Main report is fed into the sub-report query?

Thank you!!
SJH
 
You set the Link Master/Child properties of the subreport control to the fields that contain your cityID value.

Duane
MS Access MVP
[green]Ask a great question, get a great answer.[/green]
[red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
[blue]Ask me about my grandson, get a grand answer.[/blue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top