Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Biztalk CInt overflow error

Status
Not open for further replies.

HPU

Programmer
Oct 29, 2005
1
US
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top