type mismatch when caculating

E

eddie wang

The following caculcation will result type mismatch:
boe_net=oil_net+oil_gross .

Here is the value:
oil_net: 69997
oil_grss: 84651


Here is the code:
strSQl = "SELECT nvl(ROUND(SUM(A.NET_STD_PB_VOL)),0) OIL_NET,
ROUND(SUM(A.GROSS_STD_PB_VOL)) OIL_GROSS,
NVL(ROUND((SUM(A.NET_STD_PB_VOL) / SUM(A.GROSS_STD_PB_VOL)) * 100, 2),0)
EST_AGGR_OIL_INTEREST "&_
"FROM OGDWMART.PO_CMPL_MTH_ALLOC_VOL_F A"

Set rs = conn(strSQl)
if not rs.EOF then
oil_int = rs("EST_AGGR_OIL_INTEREST")
oil_net = rs("OIL_NET")
oil_gross = rs("OIL_GROSS")
boe_net=oil_net+oil_gross
end if
 
R

rwg

If the type mismatch is on the addition line, then at least one of your numbers is not really a number. You could try something like this:

boe_net=CInt(oil_net)+CInt(oil_gross)

- or -
iNet = CInt(oil_net)
iGross = CInt(oil_gross)
boe_net = iNet+iGross


-rwg
This is what I think, not necessarily what is accurate!

--------------------
| From: eddie wang <[email protected]>
| Subject: type mismatch when caculating
| Mime-Version: 1.0
| Newsgroups: microsoft.public.inetserver.asp.general
| Date: Fri, 16 Apr 2004 10:50:17 -0700
|
| The following caculcation will result type mismatch:
| boe_net=oil_net+oil_gross .
|
| Here is the value:
| oil_net: 69997
| oil_grss: 84651
|
|
| Here is the code:
| strSQl = "SELECT nvl(ROUND(SUM(A.NET_STD_PB_VOL)),0) OIL_NET,
| ROUND(SUM(A.GROSS_STD_PB_VOL)) OIL_GROSS,
| NVL(ROUND((SUM(A.NET_STD_PB_VOL) / SUM(A.GROSS_STD_PB_VOL)) * 100, 2),0)
| EST_AGGR_OIL_INTEREST "&_
| "FROM OGDWMART.PO_CMPL_MTH_ALLOC_VOL_F A"
|
| Set rs = conn(strSQl)
| if not rs.EOF then
| oil_int = rs("EST_AGGR_OIL_INTEREST")
| oil_net = rs("OIL_NET")
| oil_gross = rs("OIL_GROSS")
| boe_net=oil_net+oil_gross
| end if
|
|
| Don't just participate in USENET...get rewarded for it!
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top