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

Parameters for a SQL command in a sub report 1

Status
Not open for further replies.

KTBI

Programmer
Jul 19, 2006
2
US
Hello,

I have a sub report in the detail section of my main report. The sub report uses a sql command to get data. I need to pass a field value from the main report to the sub report to use as a parameter in the sql command in the sub report.
Main report has the field EMPLOYEE.EMPLOYEEID
In the sub report , sql command, I have - Select min(shiftstartdtm),max(shiftenddtm) from sched where empid={?Pm-EMPLOYEE.EMPLOYEEID}
group by calendar date

When I try to do this I get an error "failed to retrieve data from the database. Details: HY000:{Oracle][ODBC][Ora]ORA-24374: define not done before fetch or execute and fetch [Database Vendor Code: 24374]

I am using crystal reports XI and oracle database.

Can anyone please help.
Thanks,
K
 
Try changing the command to:

Select min(shiftstartdtm),max(shiftenddtm), empid
from sched
group by empid, calendar date

Then in the main report, link the subreport to the main report by linking {EMPLOYEE.EMPLOYEEID} to {command.empid}.

-LB
 
Lbass, Thank you! That worked.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top