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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to reference subreport field in formula

Status
Not open for further replies.

lbunch

Programmer
Sep 5, 2006
120
US
I have a subreport that has a date field on a main report - I need to use that field in a formula on the main report but I do not see it listed with the other fields so is there a way to do this???
 
If the date you want is in the subreport, then in the sub, create a formula like:

whileprintingrecords;
shared datevar subdate := {table.date};

Then in the main report, in a section below the one in which the subreport is executing, you can reference the date in a formula like:

whileprintingrecords;
shared datevar subdate;

-LB
 

I get an error "date is required" on the {table.date}

whileprintingrecords;
shared datevar subdate := {table.date};

 
You have to substitute your actual datefield for {table.date}. If you are trying to share a datetime, then use:

whileprintingrecords;
shared datetimevar subdate := {table.datetime};

How you set up this formula also depends on the layout of the subreport, how it is linked to the main report, etc., but you didn't provide that information. I think you should explain in more depth what you are trying to do with the date field. Also indicate in what report section the subreport is placed.

-LB
 
Thanks - I think my actual field has time in it also so will try your last post.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top