I have a report that's prints after click a button and the execution flow is as follows:
Button action:
AppendTempPaymentsByYearByStaffID:
And the stored procedure:
This is giving me:
The expression on click you entered as the event property setting produced the following error: Overflow.
I cant manage to track down what the problem might be... No freaking clue...
Any help would be appreciated.
Button action:
Code:
Call AppendTempPaymentsByYearByStaffID(CLng(Me.cboEmployerYear.Value))
stDocName = "rptEmployersEerMSTDebt"
If Me.chkAllYears.Value Then
gstrReportSubHeader = "EerMST Debt for ALL Years"
strSQL = "(([TotalEerMSTDue]-[TotalEerMSTPayment])< " & gcurDebtLL
Else
gstrReportSubHeader = "EerMST Debt for Year = " & Me.cboEmployerYear.Value
strSQL = "[Year]=" & Me.cboEmployerYear.Value
strSQL = strSQL & " AND (([TotalEerMSTDue]-[TotalEerMSTPayment])< " & gcurDebtLL
End If
strSQL = strSQL & " OR ([TotalEerMSTDue]-[TotalEerMSTPayment])> " & gcurDebtUL & ")"
AppendTempPaymentsByYearByStaffID:
Code:
Sub AppendTempPaymentsByYearByStaffID(lngYear As Long)
Dim cmdAppend As ADODB.Command
Set cmdAppend = New ADODB.Command
Dim prm As ADODB.Parameter
With cmdAppend
Set .ActiveConnection = CurrentProject.Connection
.CommandType = adCmdStoredProc
.CommandText = "usp_AppendTempPaymentsByYearByStaffID"
Set prm = .CreateParameter("@Year", adInteger, adParamInput, 4)
prm.Value = lngYear
.Parameters.Append prm
Set prm = .CreateParameter("@StaffID", adInteger, adParamInput, 4)
prm.Value = gUserID
.Parameters.Append prm
' Run the SP usp_AppendTempPaymentsByYearByStaffID
.Execute
End With
Set prm = Nothing
Set cmdAppend = Nothing
End Sub
And the stored procedure:
Code:
ALTER PROCEDURE [dbo].[usp_AppendTempPaymentsByYearByStaffID]
(
@Year int,
@StaffID int
)
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
DELETE FROM TblTempPayments WHERE [EMAIL="StaffID=@StaffID"]StaffID=@StaffID[/EMAIL]
INSERT INTO TblTempPayments
(EntryNo, CRSNo, PIN, Year, DatePaid, PmtType, Amount, Reference, DebtPeriod, SubNo, StaffID, LoginName)
SELECT EntryNo, CRSNo, PIN, Year, DatePaid, PmtType, Amount, Reference, DebtPeriod, SubNo, @StaffID AS StaffID, dbo.ExtractLoginName()
FROM TblPayments
WHERE (Year = @Year)
This is giving me:
The expression on click you entered as the event property setting produced the following error: Overflow.
I cant manage to track down what the problem might be... No freaking clue...
Any help would be appreciated.