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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help With a Null Problem?

Status
Not open for further replies.

tekyge

Programmer
Dec 11, 2005
125
US
I need some help? I am tring to have an asp called continue, now when the client clicks the link it takes them to the page where it checks to see if the value of a record is 0. Basicly it works if there is a value but if there is no value it give an error. Any help?

Microsoft VBScript runtime error '800a000d'

Type mismatch: 'FormatCurrency'

/login/pay/continue.asp, line 24



If FormatCurrency(rs("Invoice")))<0.0049999999 Then
response.redirect("/login/pay/error.asp")
else
session("cs_e10")=FormatCurrency(rs("Invoice"))
response.redirect("/login/pay/")
End If
rs.close
 
first make sure that rs("Invoice") is not empty..

second...try using CINT or CDBL for comparison purposes

If CINT(rs("Invoice"))< 0.0049999999 Then
response.redirect("/login/pay/error.asp")
else
session("cs_e10")=FormatCurrency(rs("Invoice"))
response.redirect("/login/pay/")
End If
rs.close

-DNG
 
Thanks Dot works great as long as there is a value but it gives this error when there is no record.

Microsoft VBScript runtime error '800a005e'

Invalid use of Null: 'CINT'

/login/pay/continue.asp, line 24
 
then you have say something like this:

Code:
if rs("Invoice")<>"" then
If CINT(rs("Invoice"))< 0.0049999999 Then
response.redirect("/login/pay/error.asp")
else
session("cs_e10")=FormatCurrency(rs("Invoice"))
response.redirect("/login/pay/")
End If
End if
rs.close

you can put a else condition if you want and do the appropiate thing...post back if you have any other questions...

-DNG
 
Thanks dot. No error now but the page is blank and its not redirecting to the error page?
 
Got it thanks Dot for your help!

If rs("Invoice")<>"" then
If CINT(rs("Invoice"))< 0.0049999999 Then
response.redirect("/login/pay/error.asp")
else
session("cs_e10")=FormatCurrency(rs("Invoice"))
response.redirect("/login/pay/")
End If
else
response.redirect("/login/pay/error.asp")
End If
rs.close
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top