Problem, I am prompted twice for the same parameters. It makes sense because both sprocs are using the same parameter information but it would be nice to find a way to pass that parameter so the end user does not have to enter it twice.
History:
I have a form that is populated with a stored procedure and it works great. The key fields in here is the empid, beginning period date and ending period date. This is the MAIN form.
Inside of this form, I have a subform that is calling the hours for this employee and the date range that is given. This is also from a stored procedure. This sproc also returns the correct data that is needed. Here is my code for this sproc:
Thanks
CREATE PROCEDURE dbo.sp_PayTypesandHoursSummaryDateRange
@EnterEmpNo int
,@EnterStartingCheckDate datetime
,@EnterEndingCheckDate datetime
AS
SELECT DISTINCT
pc.emp_no
, pcpa.pay_type
, pt.description
, SUM(pcpa.hours) AS Hours
, SUM(pcpa.cmw_gross) AS Gross
FROM
pay_checks AS pc
INNER JOIN
pay_checks_pay_assoc AS pcpa
ON
pc.pay_checks = pcpa.pay_checks
INNER JOIN
dbo.pay_types AS pt
ON
pcpa.pay_type = pt.pay_type
WHERE
pc.emp_no = --@EnterEmpNo
6111
AND
CONVERT(smalldatetime, pc.check_date)
BETWEEN --@EnterStartingCheckDate
'2000-01-01 00:00:00'
AND --@EnterEndingCheckDate
'2000-06-30 00:00:00'
GROUP BY
pc.emp_no
, pcpa.pay_type
, pt.description
History:
I have a form that is populated with a stored procedure and it works great. The key fields in here is the empid, beginning period date and ending period date. This is the MAIN form.
Inside of this form, I have a subform that is calling the hours for this employee and the date range that is given. This is also from a stored procedure. This sproc also returns the correct data that is needed. Here is my code for this sproc:
Thanks
CREATE PROCEDURE dbo.sp_PayTypesandHoursSummaryDateRange
@EnterEmpNo int
,@EnterStartingCheckDate datetime
,@EnterEndingCheckDate datetime
AS
SELECT DISTINCT
pc.emp_no
, pcpa.pay_type
, pt.description
, SUM(pcpa.hours) AS Hours
, SUM(pcpa.cmw_gross) AS Gross
FROM
pay_checks AS pc
INNER JOIN
pay_checks_pay_assoc AS pcpa
ON
pc.pay_checks = pcpa.pay_checks
INNER JOIN
dbo.pay_types AS pt
ON
pcpa.pay_type = pt.pay_type
WHERE
pc.emp_no = --@EnterEmpNo
6111
AND
CONVERT(smalldatetime, pc.check_date)
BETWEEN --@EnterStartingCheckDate
'2000-01-01 00:00:00'
AND --@EnterEndingCheckDate
'2000-06-30 00:00:00'
GROUP BY
pc.emp_no
, pcpa.pay_type
, pt.description