My project is based on a2003adp with sql2000 srv.
Over there i want to control input validity check via Sp and VBA. That's why I write the following Stoted Proc as well as VBA Function and Procedure . Problem Is that when I Pass this input it prompt "type mismatch"
I 'd not figure it out where I made a mistake , any suggestion would be highly appreciated .
My Stored Procedure::
Here is VBA Function
Procedure to Call this Function
<>>>>>>>>Naina< >>>>>>>>>>>
Over there i want to control input validity check via Sp and VBA. That's why I write the following Stoted Proc as well as VBA Function and Procedure . Problem Is that when I Pass this input it prompt "type mismatch"
I 'd not figure it out where I made a mistake , any suggestion would be highly appreciated .
My Stored Procedure::
Code:
CREATE Procedure dbo.CheckBalance
@EconomicID int,
@CurrentBalance int,
@CAmount int
AS
SET NOCOUNT ON
BEGIN
Declare @count bit
set @count=0
Select @count =isnull(count(*),0) from hdc_economict where ecoid = @EconomicID
and economic between cast('0010' as int) and cast('4399' as int)
and economic between cast('8000' as int) and cast('8999' as int)
if @CAmount >@CurrentBalance and @count = 0
begin
return select 0
end
else
begin
return select 1
end
END
GO
Code:
Private Function CheckChild() As Boolean
Dim Valid As String
Valid = " Exec dbo.CheckBalance " & Me.CboEconomic & ", " & Me.tXtHDC_Bal & "," & Me.TxtCodeAmount
If Me.tXtHDC_Bal <> 0 And Valid = 0 Then
MsgBox " Insufficient Budget amount", vbInformation, "information"
Me.TxtCodeAmount.SetFocus
CheckChild = False
Else
CheckChild = True
End If
End Function
Code:
Private Sub txtCodeAmount_AfterUpdate()
'On Error GoTo err:
If CheckChild = False Then
Exit Sub
Else
If MsgBox(" add another transaction ? ", vbYesNo, "Confirmation") = vbNo Then Exit Sub
If HDC_BillChildSave = True Then
MsgBox" Data Saved", vbInformation, "Information"
Else
MsgBox" Data Not Save", vbInformation, "Information"
End If
Exit Sub
End If
'err:
'MsgBox err.Description, vbCritical, "Error"
'Exit Sub
End Sub
<>>>>>>>>Naina< >>>>>>>>>>>
Comment