C
Cathi
I'm looking for an adp expert to shed some light on this problem for me.
I have an Order form (based on tblOrder) with a field OrderNo I have an
Order Detail subform (based on tblOrderDetail) where staff are selected (a
dropdown and the asID field is bound = AgencyStaffID) and a date is entered
and a shift is selected from a dropdown (ie day or night) then a button is
clicked to run the stored procedure spUpdateRosterOrders. This stored
procedure finds the matching asID, Date and Shift in the table
tblAgencyStaffRoster and updates these three fields to match the asID, Date
and Shift selected in the Order Detail subform.
My dilemma is it works sometimes ie Catherine Larsen has asID 1 and it works
and but Donna Young asID 179 does not? Is anyone able to indicate why this
stored procedure would work for some asID's and not others?
The stored procedure is run using the VBA statement:
DoCmd.OpenStoredProcedure "dbo.spUpdateRosterOrders"
The stored procedure is:
UPDATE dbo.tblAgencyStaffRoster
SET rOrderNo =
(SELECT tblOrder.ordOrderNo
FROM tblOrder INNER JOIN
tblOrderDetail ON
tblOrder.ordOrderNo = tblOrderDetail.ordID
WHERE (rDate =
tblOrderDetail.odDateRequired) AND (rShift = tblOrderDetail.odShiftRequired)
AND (asID = tblOrderDetail.odAgencyStaffID)),
rActualStdHours =
(SELECT tblOrderDetail.odActualStdHours
FROM tblOrderDetail
WHERE (rDate =
tblOrderDetail.odDateRequired) AND (rShift = tblOrderDetail.odShiftRequired)
AND (asID = tblOrderDetail.odAgencyStaffID)),
rActualOTHours =
(SELECT tblOrderDetail.odActualOTHours
FROM tblOrderDetail
WHERE (rDate =
tblOrderDetail.odDateRequired) AND (rShift = tblOrderDetail.odShiftRequired)
AND (asID = tblOrderDetail.odAgencyStaffID)),
rActualTotHours =
(SELECT tblOrderDetail.odActualTotHours
FROM tblOrderDetail
WHERE (rDate =
tblOrderDetail.odDateRequired) AND (rShift = tblOrderDetail.odShiftRequired)
AND (asID = tblOrderDetail.odAgencyStaffID))
I have checked the data types as follows:
tblOrder
ordOrderNo=int 4, identity, therefore do not allow nulls
tblOrderDetail
odAgencyStaffID=int 4, allow nulls
odDateRequired=Date/time
odShiftRequired=varchar, 10, do not allow nulls
tblAgencyStaffRoster
asID=int, 4 no identify, do not allow nulls
rDate=date/time, do not allow nulls
rShift=varchar 10, do not allow nulls
rOrderNo=varchar 50, allow nulls
If it didn't run at all that would make sense, but the fact it works
sometimes and not other times is odd? Any help would be much appreciated.
Thanks in advance Cathi
I have an Order form (based on tblOrder) with a field OrderNo I have an
Order Detail subform (based on tblOrderDetail) where staff are selected (a
dropdown and the asID field is bound = AgencyStaffID) and a date is entered
and a shift is selected from a dropdown (ie day or night) then a button is
clicked to run the stored procedure spUpdateRosterOrders. This stored
procedure finds the matching asID, Date and Shift in the table
tblAgencyStaffRoster and updates these three fields to match the asID, Date
and Shift selected in the Order Detail subform.
My dilemma is it works sometimes ie Catherine Larsen has asID 1 and it works
and but Donna Young asID 179 does not? Is anyone able to indicate why this
stored procedure would work for some asID's and not others?
The stored procedure is run using the VBA statement:
DoCmd.OpenStoredProcedure "dbo.spUpdateRosterOrders"
The stored procedure is:
UPDATE dbo.tblAgencyStaffRoster
SET rOrderNo =
(SELECT tblOrder.ordOrderNo
FROM tblOrder INNER JOIN
tblOrderDetail ON
tblOrder.ordOrderNo = tblOrderDetail.ordID
WHERE (rDate =
tblOrderDetail.odDateRequired) AND (rShift = tblOrderDetail.odShiftRequired)
AND (asID = tblOrderDetail.odAgencyStaffID)),
rActualStdHours =
(SELECT tblOrderDetail.odActualStdHours
FROM tblOrderDetail
WHERE (rDate =
tblOrderDetail.odDateRequired) AND (rShift = tblOrderDetail.odShiftRequired)
AND (asID = tblOrderDetail.odAgencyStaffID)),
rActualOTHours =
(SELECT tblOrderDetail.odActualOTHours
FROM tblOrderDetail
WHERE (rDate =
tblOrderDetail.odDateRequired) AND (rShift = tblOrderDetail.odShiftRequired)
AND (asID = tblOrderDetail.odAgencyStaffID)),
rActualTotHours =
(SELECT tblOrderDetail.odActualTotHours
FROM tblOrderDetail
WHERE (rDate =
tblOrderDetail.odDateRequired) AND (rShift = tblOrderDetail.odShiftRequired)
AND (asID = tblOrderDetail.odAgencyStaffID))
I have checked the data types as follows:
tblOrder
ordOrderNo=int 4, identity, therefore do not allow nulls
tblOrderDetail
odAgencyStaffID=int 4, allow nulls
odDateRequired=Date/time
odShiftRequired=varchar, 10, do not allow nulls
tblAgencyStaffRoster
asID=int, 4 no identify, do not allow nulls
rDate=date/time, do not allow nulls
rShift=varchar 10, do not allow nulls
rOrderNo=varchar 50, allow nulls
If it didn't run at all that would make sense, but the fact it works
sometimes and not other times is odd? Any help would be much appreciated.
Thanks in advance Cathi