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!

Dsum in subreport based on Criteria in Main report

Status
Not open for further replies.

Cosette

Technical User
Nov 30, 2004
98
US
Good evening all,

I search for this and couldn't find a thread, but I think it must have happened before.

I have a report rptWeeklyFeesembedded as a subreport in three different reports. rptPayPlus, rptPayMinus, rptPayTotal. I have an unbound control that generate a Dsum function in the subreport with criteria IDNumber being in the main report. My problem is that since all three reports are different, I get error messages if I reference by report name reports!rptPayPlus!IDNumber. So I tried to reference with Me!IdNumber.value and get an error as well. Anyone can lead me to the promised land?

I also tried to copy the IDNumber txtbox in the subreport and reference it there, but I generate an error as well. I tried RoyVidar's great tip about using the builder (he mentioned it for subforms) but it doesn't seem to work for subreport.

Any help is apreciated, I am sick with syntax.

Thanks

Cosette
 
If I understand correctly, the syntax for pulling a value from a text box in a subreport, use:
=srptControlName.Report.txtOnSubReport

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]
 
Duane,

I am sorry I was not clear enough. The Dsum function is in the subreport. It pulls a value from the main report. However, it will pull the value from three different main reports. What is the syntax to pull from the Open main report, regardless of its name? That is what I can't figure out.

right now, my Dsum function is:

=Dsum("[expenses]","tblfinancials","[IDNumber]=reports!rptPayPlus!txtIDNumber")

This works when I open rptPayPlus but generates errors when I open rptPayMinus. I can't get the right syntax. Hope this is clearer.

Thanks

Cosette
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top