Hey everyone. I trying to compare two dates using biztalk. the dates come in the arguments as strings. i want to output a false if the difference between var1 and var2 if > 31. I get a VB overflow error when the code subtracts var2 from var1. So i commented out the logic portion and still get the error. I can't see the problem. Can anybody help? Thanks in advance.
Function datedif(CurDate,Term)
'Do not pass terms greater than 31 days
Dim var1, var2, difference
var1 =Replace(Curdate, "-", "") 'CurDate
var1= Cint(var1)
var2 = Mid(Term, 7, 4) + Mid(Term, 1, 2) + Mid(Term, 4, 2) 'TermDate
var2=Cint(var2)
datedif= var1- var2
'If difference >"0" then
'If CInt(difference) >= 31 Or CInt(difference) < -1 Then
'datedif = "false"
'ElseIf CInt(difference) < 31 And CInt(difference) >= -31 Then
'datedif = "true"
'Else
'datedif = ""'
'End If
'Else
'datedif = "true"'
'End If
End Function
Function datedif(CurDate,Term)
'Do not pass terms greater than 31 days
Dim var1, var2, difference
var1 =Replace(Curdate, "-", "") 'CurDate
var1= Cint(var1)
var2 = Mid(Term, 7, 4) + Mid(Term, 1, 2) + Mid(Term, 4, 2) 'TermDate
var2=Cint(var2)
datedif= var1- var2
'If difference >"0" then
'If CInt(difference) >= 31 Or CInt(difference) < -1 Then
'datedif = "false"
'ElseIf CInt(difference) < 31 And CInt(difference) >= -31 Then
'datedif = "true"
'Else
'datedif = ""'
'End If
'Else
'datedif = "true"'
'End If
End Function