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!

Stored Procedure with Parameters How-To lesson...

Status
Not open for further replies.

BobJacksonNCI

Technical User
Mar 11, 2003
725
US
TIA!

I'm trying, really I am. (Just ask my wife...)

Environment = .ADP using Access 2000 with SQL 7

I have forms that use stored procedures for their record sources. My payroll department has asked me to provide the same forms, but populated with data for the current pay period only, which is two weeks.

I found thread181-641505, which is a help, but I'm still a bit thick as to how to make it work. Payroll uses a selection form with buttons to select working forms where I could add starting and ending date controls. The working forms contain buttons to select by status. I'd like to add the date controls to the selection form and then add a button to the working form that would check for and validate the date entries and add BETWEEN START DATE AND END DATE to copies of the existing stored procedures to get them what they need.

One of the existing stored procedures is:
Alter Procedure MgrTB_spr_Time_Off_Show_New
AS
SELECT
dbo.MgrTB_tbl_Time_Off.FormID_One,
dbo.MgrTB_tbl_Time_Off.FormStatus,
dbo.MgrTB_tbl_Time_Off.EmpLastName,
dbo.MgrTB_tbl_Time_Off.EmpLglFirstName,
dbo.MgrTB_tbl_Time_Off.EmpMidName,
dbo.MgrTB_tbl_Time_Off.Dept,
dbo.MgrTB_tbl_Time_Off.DateOfForm,
dbo.MgrTB_tbl_Time_Off.DtCreated,
--FOLLOWING STRIPS OFF DOMAIN NAME AND ADDS A SPACE BETWEEN FIRST INITIAL AND LAST NAME
substring(dbo.MgrTB_tbl_Time_Off.Submitted_By, CHARINDEX('\',dbo.MgrTB_tbl_Time_Off.Submitted_By)+1,1) + ' ' +
substring(dbo.MgrTB_tbl_Time_Off.Submitted_By, CHARINDEX('\',dbo.MgrTB_tbl_Time_Off.Submitted_By)+2,19) AS Submitted_By
FROM
dbo.MgrTB_tbl_Time_Off
WHERE
dbo.MgrTB_tbl_Time_Off.FormStatus = '1'
ORDER BY
dbo.MgrTB_tbl_Time_Off.EmpLastName,
dbo.MgrTB_tbl_Time_Off.EmpLglFirstName,
dbo.MgrTB_tbl_Time_Off.EmpMidName,
dbo.MgrTB_tbl_Time_Off.DateOfForm DESC
RETURN
===============================================

Again, your assistance IS appreciated!
Bob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top