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!

numbering issue 2

Status
Not open for further replies.

andyc209

IS-IT--Management
Dec 7, 2004
98
GB
I have a site where the user builds a batch of data with a total for the batch of
rs("totalbatch")

once they have completed the batch they process that batch
and the system asigns a new session batch number. my prblem here is the rs("totalbatch") returns NULL and this throws out errors, usually Type Mismatch errors or invaliduse of NULL

Essentially rs("totalbatch") can be either Null or a value to two decimal places. What I want to do is say that

s="SELECT SUM(loanvalue) AS totalbatch FROM dbo.tbl_balance WHERE (batchID = "&session("batchno")&")"
set rs=db.execute(s)

if rs("totalbatch") IS NULL then
batchno = 0
else
batchno = rs("totalbatch")
end if

but making sure there is no rounding up as it is money. So for the second, third etc loans in the batch the rs("totalbatch") returns a number (it must be in numeric form to two decimal places)
 
Code:
if isNull(rs("totalbatch")) or isEmpty(rs("totalbatch")) or rs("totalbatch") = "" then
batchno = 0
else
batchno = rs("totalbatch")
end if

TIP: trying googling the answer before posting, you'll find that more times than not someone else somewhere has had the same request and posted an answer online.
----
I have recently been semi-converted to ensuring all my code (well most of it) works in both javascript and non-javascript enabled browsers
 
my guess is that the field in question is probably a deriviative of a bloc/memo field... there's known issues doing comparisons and null values for them

usually i'll just dim a single dimsion array and do the comparisons against the assigned value such as:
Code:
dim tempval(0) 

do while blah blah....
tempval(0) = rs(memofield)
if tempval(0) <> "" or not isnull(tempval(0)) then
........ whatever else

reason being is memo/blob fields (figuratively not literally) are detached, they only return a value when "pushed" meaning they have to be put to actual flow, being assigned to a variable, or outputted, as for comparison they show a null because the datasource tends to show nothing there because all that is there is a hidden pointer to the blob location whether or not it's empty

[thumbsup2]DreX
aKa - Robert
if all else fails, light it on fire and do the happy dance!
" I always think outside the 'box', because I'm never in the 'loop' " - DreX 2005
 
bloc = blob, i cant type worth a poo

[thumbsup2]DreX
aKa - Robert
if all else fails, light it on fire and do the happy dance!
" I always think outside the 'box', because I'm never in the 'loop' " - DreX 2005
 
DNG - very good tip ^*

[thumbsup2]DreX
aKa - Robert
if all else fails, light it on fire and do the happy dance!
" I always think outside the 'box', because I'm never in the 'loop' " - DreX 2005
 
Thanks DreXor,

Just contributing whatever I have learned from here...recently been very busy though..

-DNG
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top