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

Negative Value returns as null from VBScript function

Status
Not open for further replies.

JimFlower

Programmer
Jun 21, 2001
42
GB
This function returns a null when the value of "StartingHours" is a negative.

is there something I can do or do I have to convert to posative numbers with a negative flag?

function GetStartHours(CustomerNo)
Set db = Server.CreateObject("ADODB.Connection")
db.Open "Provider=Microsoft.Jet.OLEDB.4.0; " & _
"Data Source=" & Server.Mappath("\dbdemo\fpdb\extranet.mdb") & ";" & "Jet OLEDB:Database Password="

set rst = db.Execute("SELECT StartingHours, CustomerNo FROM Customers WHERE (((Customers.CustomerNo)=" & CustomerNo & "));")

select case rst.eof
case true
GetStartHours = 0
case false
rst.movefirst
select case rst.fields("StartingHours").value
case null,""," "
GetStartHours = 0
case false
GetStartHours = rst.fields("StartingHours").value
end select
end select
set rst = nothing
set db = nothing
end function
 
Sorry Found The Problem

Case false

should be

Case else
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top