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

Limiting subreport results 1

Status
Not open for further replies.

CosmoKramer

Programmer
Joined
May 29, 2001
Messages
1,730
Location
US
I have a main report that lists cancelled patient appointments. The user wants to see all future appointments for that patient as well.

I created a subreport, linked that subreport to the main report by patient id. That subreport works, I see all of each patient's appointments.

How do I now reference the appointment date/time field in the main report to only return the future appointments in the subreport??
 
In your subreport's Select Expert use:

{appointment.date.field}>currentdate

This will give you all future date or use >= currentdate to show appointments for today and the future. Mike
If you're not part of the solution, you're part of the precipitate.
 
Mike,

Thanks for your quick response, but I don't think I was clear enough in my original post.

I need to only return appointments in the subreport whose date is greater than the date in the main report. Each of the dates involved might be earlier than today.

For example, I run the report today for a range of 1/1/03 to 1/8/03. A patient had an appointment scheduled for 1/2/03 that was cancelled and rescheduled for 1/6/03. Currently, the main report shows the 1/2 appt like it should, but the subreport shows all of his older appts as well. The user wants to see only his appts scheduled after the 1/2 one.

I'm sorry I didn't explain it better the first time around....
 
Is your date reange is supplied using a parameter? If so do the following:

Right click on your sub-report and choose Change Subroeport Links... Pick you parameter field and link it with the date field in the subreport.

Mike
If you're not part of the solution, you're part of the precipitate.
 
Yes, the report has ?StartDate and ?StopDate parameters. But, if I add a link of one of those, it only returns appts equal to that date. And, in the case I mentioned above, the dates are both in-between the date parameters.

From a subreport, is there a way to reference the date field in the main report, and in this case, only return rows greater than that date field?
 
You can do two things.

1> Change the parameter to a range type instead of the start and end dates.

OR

2> In the subreport use the following for your select expert:(You'll have to link both parameters to the sub)

{subreport.date field} in {?Pm-?StartDate}to {?Pm-?StopDate}


Mike
If you're not part of the solution, you're part of the precipitate.
 
Mike,

Thanks for pointing me in the right direction. Here's what I did:

1). I added a suppressed formula field to the detail section of my main report (@dateparam) which simply holds the date/time field.

2). In the subreport I added criteria to the select expert to only include its records that are after the main report's @dateparam date:
Code:
{appt.start_datetime} > {?Pm-@dateparam}

From what I've tested so far, it works.....

Once again, thanks for your help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top