G
Guest
Hello, I really need some help. I have an Access 2003 form and a SQL 2000
table. I have a stored procedure to insert records. I keep getting a
"Precision is invalid" when I try to execute the stored procedure because I
changed some of my fields to "Numeric" from "Integer" because I need decimal
places. Here is my info:
In Access module:
Public Function InsertTimeSheet(pDate, pStartTime, pLunchOut, pLunchIn,
pEndTime, pReasonOT, pVacationHours, pSickHours, pOtherHours, pUnpaidHours,
pEmployeeID, pHolidayHours)
Set cmd = New ADODB.Command
With cmd
Set .ActiveConnection = CurrentProject.Connection
.CommandText = "spTimeSheetInsert"
.CommandType = adCmdStoredProc
.CommandTimeout = 6000
.Parameters.Append .CreateParameter("@StartDate", adDBDate,
adParamInput, 8, pDate)
.Parameters.Append .CreateParameter("@StartTime", adDBDate,
adParamInput, 8, pStartTime)
.Parameters.Append .CreateParameter("@LunchOut", adDBDate, adParamInput,
8, pLunchOut)
.Parameters.Append .CreateParameter("@LunchIn", adDBDate, adParamInput,
8, pLunchIn)
.Parameters.Append .CreateParameter("@EndTime", adDBDate, adParamInput,
8, pEndTime)
.Parameters.Append .CreateParameter("@ReasonOT", adVarChar,
adParamInput, 20, pReasonOT)
.Parameters.Append .CreateParameter("@VacationHours", adNumeric,
adParamInput, 9, pVacationHours)
.Parameters.Append .CreateParameter("@SickHours", adNumeric,
adParamInput, 9, pSickHours)
.Parameters.Append .CreateParameter("@OtherHours", adNumeric,
adParamInput, 9, pOtherHours)
.Parameters.Append .CreateParameter("@UnpaidHours", adNumeric,
adParamInput, 9, pUnpaidHours)
.Parameters.Append .CreateParameter("@EmployeeID", adInteger,
adParamInput, 0, pEmployeeID)
.Parameters.Append .CreateParameter("@HolidayHours", adInteger,
adParamInput, 0, pHolidayHours)
Set rst = .Execute
End With
Set cmd = Nothing
End Function
My stored procedure:
CREATE PROCEDURE [dbo].[spTimeSheetInsert]
@StartDate datetime,
@StartTime datetime,
@LunchOut datetime,
@LunchIn datetime,
@EndTime datetime,
@ReasonOT varchar(20),
@VacationHours numeric,
@SickHours numeric,
@OtherHours numeric,
@UnpaidHours numeric,
@EmployeeID int,
@HolidayHours int
AS
SET NOCOUNT ON
INSERT INTO [dbo].[tblTimeSheet] (
[StartDate],
[StartTime],
[LunchOut],
[LunchIn],
[EndTime],
[ReasonOT],
[VacationHours],
[SickHours],
[OtherHours],
[UnpaidHours],
[EmployeeID],
[HolidayHours]
) VALUES (
@StartDate,
@StartTime ,
@LunchOut,
@LunchIn,
@EndTime,
@ReasonOT,
@VacationHours,
@SickHours,
@OtherHours,
@UnpaidHours,
@EmployeeID,
@HolidayHours
)
GO
My table, the Vacation, Sick, Other and Unpaid Hours are all
Data Type: Numeric
Length: 9
Allow Nulls: True
Precision: 19
Scale: 4
I have changed these fields to decimal, double etc and keep getting the same
error. I am so confused now I really just don't know what to use for my
field type. The data I am storing in these fields numeric and may have up to
2 decimal places. For example:
3.5
7
4.75
Any help would be very greatly appreciated.
table. I have a stored procedure to insert records. I keep getting a
"Precision is invalid" when I try to execute the stored procedure because I
changed some of my fields to "Numeric" from "Integer" because I need decimal
places. Here is my info:
In Access module:
Public Function InsertTimeSheet(pDate, pStartTime, pLunchOut, pLunchIn,
pEndTime, pReasonOT, pVacationHours, pSickHours, pOtherHours, pUnpaidHours,
pEmployeeID, pHolidayHours)
Set cmd = New ADODB.Command
With cmd
Set .ActiveConnection = CurrentProject.Connection
.CommandText = "spTimeSheetInsert"
.CommandType = adCmdStoredProc
.CommandTimeout = 6000
.Parameters.Append .CreateParameter("@StartDate", adDBDate,
adParamInput, 8, pDate)
.Parameters.Append .CreateParameter("@StartTime", adDBDate,
adParamInput, 8, pStartTime)
.Parameters.Append .CreateParameter("@LunchOut", adDBDate, adParamInput,
8, pLunchOut)
.Parameters.Append .CreateParameter("@LunchIn", adDBDate, adParamInput,
8, pLunchIn)
.Parameters.Append .CreateParameter("@EndTime", adDBDate, adParamInput,
8, pEndTime)
.Parameters.Append .CreateParameter("@ReasonOT", adVarChar,
adParamInput, 20, pReasonOT)
.Parameters.Append .CreateParameter("@VacationHours", adNumeric,
adParamInput, 9, pVacationHours)
.Parameters.Append .CreateParameter("@SickHours", adNumeric,
adParamInput, 9, pSickHours)
.Parameters.Append .CreateParameter("@OtherHours", adNumeric,
adParamInput, 9, pOtherHours)
.Parameters.Append .CreateParameter("@UnpaidHours", adNumeric,
adParamInput, 9, pUnpaidHours)
.Parameters.Append .CreateParameter("@EmployeeID", adInteger,
adParamInput, 0, pEmployeeID)
.Parameters.Append .CreateParameter("@HolidayHours", adInteger,
adParamInput, 0, pHolidayHours)
Set rst = .Execute
End With
Set cmd = Nothing
End Function
My stored procedure:
CREATE PROCEDURE [dbo].[spTimeSheetInsert]
@StartDate datetime,
@StartTime datetime,
@LunchOut datetime,
@LunchIn datetime,
@EndTime datetime,
@ReasonOT varchar(20),
@VacationHours numeric,
@SickHours numeric,
@OtherHours numeric,
@UnpaidHours numeric,
@EmployeeID int,
@HolidayHours int
AS
SET NOCOUNT ON
INSERT INTO [dbo].[tblTimeSheet] (
[StartDate],
[StartTime],
[LunchOut],
[LunchIn],
[EndTime],
[ReasonOT],
[VacationHours],
[SickHours],
[OtherHours],
[UnpaidHours],
[EmployeeID],
[HolidayHours]
) VALUES (
@StartDate,
@StartTime ,
@LunchOut,
@LunchIn,
@EndTime,
@ReasonOT,
@VacationHours,
@SickHours,
@OtherHours,
@UnpaidHours,
@EmployeeID,
@HolidayHours
)
GO
My table, the Vacation, Sick, Other and Unpaid Hours are all
Data Type: Numeric
Length: 9
Allow Nulls: True
Precision: 19
Scale: 4
I have changed these fields to decimal, double etc and keep getting the same
error. I am so confused now I really just don't know what to use for my
field type. The data I am storing in these fields numeric and may have up to
2 decimal places. For example:
3.5
7
4.75
Any help would be very greatly appreciated.