CodingVB Script Question

 

Press Ctrl+Enter to quickly submit your post
Quick Reply  
 
 
  
 From:  Mod_Inside (MODINSIDE)   
 To:  Peter (BOUGHTONP)     
33245.21 In reply to 33245.19 

Ok doing it this way at least the page loads, but on calling the result on line 534 <% document.write (calcHotWaterFactor) %>

 

I get this !

 

Technical Information (for support personnel)

 

Error Type:
Microsoft VBScript runtime (0x800A01A8)
Object required: ''
/Degday/DegreeDayslist.asp, line 534

0/0
 Reply   Quote More 

 From:  Peter (BOUGHTONP)  
 To:  Mod_Inside (MODINSIDE)      
33245.22 In reply to 33245.21 
You need to call the function too, ie:
code:
<% document.write( calcHotWaterFactor( bob ) ) %>

Except bob would be whatever is being passed in to the function... can't remember what that was.
0/0
 Reply   Quote More 

 From:  Mod_Inside (MODINSIDE)   
 To:  Peter (BOUGHTONP)     
33245.23 In reply to 33245.22 

Ok that'll be this then
<% document.write(calcHotWaterFactor(strdegday)) %>

 

And I get this ! ARGHH
Technical Information (for support personnel)

 

Error Type:
Microsoft VBScript runtime (0x800A000D)
Type mismatch: 'calcHotWaterFactor'
/Degday/DegreeDayslist.asp, line 534

 

Think we should just give up ?

0/0
 Reply   Quote More 

 From:  Mod_Inside (MODINSIDE)   
 To:  Peter (BOUGHTONP)     
33245.24 In reply to 33245.22 
Got it it's finally working many thanks for your patience (and you Kenny)

This has to be an easy one


1 1994 19 13 16 3 0 03
1 1994 18 11 14.5 4.5 3 34.5

See those two end figures? The first one should be a sum of the 2 numbers to the left ie 3+0= 3

But its added the 0 to the total but not the sum

You see it better in the following one which should be 4.5 + 3 = 7.5

but it shows as 34.5 ie 3 and 4.5 as one number. This is driving me up the forkin wall now, any ideas?
0/0
 Reply   Quote More 

 From:  Kenny J (WINGNUTKJ)  
 To:  Mod_Inside (MODINSIDE)      
33245.25 In reply to 33245.24 
You need to convert them to numbers, because they're being treated as strings, by the look of things. Since they're decimals, you're best to use the clng() function. What are the other numbers? Is the whole line a string?

Kenny
The Wisdom of IMDB Messageboards:
One Night At McCool's

There's one thing I don't understand: Why would Randy and Jewel, for some reason, have sex right at the beginning of the movie?

-- Um, like, are you kidding? Randy sees the golden opportunity (like finding plutonium by accident) and takes it.
0/0
 Reply   Quote More 

 From:  Mod_Inside (MODINSIDE)   
 To:  Kenny J (WINGNUTKJ)     
33245.26 In reply to 33245.25 

Hi Kenny,

 

Don't laugh at my fudged together code, it works but probably the worst way to do things, but here goes !

 

<% DIM total, tav, tdd
tav= strdegday
tdd= response.write(calcHotWaterFactor(strdegday))
total= tdd + tav
%>
<% response.write(total) %>

 

In total I want it to add those to feckers together but it simply add's the b*stards side by side!

 

I need a drink.

0/0
 Reply   Quote More 

 From:  Kenny J (WINGNUTKJ)  
 To:  Mod_Inside (MODINSIDE)      
33245.27 In reply to 33245.26 

Nah - you just need to learn to code.

 

But anyway:

 

<% DIM total, tav, tdd
tav= strdegday
tdd= calcHotWaterFactor(strdegday))
total= clng(tdd) + clng(tav)

 

response.write(total) %>

 

Should work. Probably. It's untested.


Kenny
The Wisdom of IMDB Messageboards:
One Night At McCool's

There's one thing I don't understand: Why would Randy and Jewel, for some reason, have sex right at the beginning of the movie?

-- Um, like, are you kidding? Randy sees the golden opportunity (like finding plutonium by accident) and takes it.
0/0
 Reply   Quote More 

 From:  Mod_Inside (MODINSIDE)   
 To:  Kenny J (WINGNUTKJ)     
33245.28 In reply to 33245.27 

Your the man !

 

4.5 | 3 | 7

 

How does it not do the .5 though? Feel free to tell me to f*ck off

 

That's a few pint's I'll be due you

0/0
 Reply   Quote More 

 From:  Kenny J (WINGNUTKJ)  
 To:  Mod_Inside (MODINSIDE)      
33245.29 In reply to 33245.28 

Meh - I've forgotten my VB - it's not CLng you need, it's CDbl. One converts to a long integer, the other to a double-precision floating point number.

 

So, in that last snippet, replace Clng with CDbl everywhere it appears.


Kenny
The Wisdom of IMDB Messageboards:
One Night At McCool's

There's one thing I don't understand: Why would Randy and Jewel, for some reason, have sex right at the beginning of the movie?

-- Um, like, are you kidding? Randy sees the golden opportunity (like finding plutonium by accident) and takes it.
0/0
 Reply   Quote More 

 From:  Mod_Inside (MODINSIDE)   
 To:  Kenny J (WINGNUTKJ)     
33245.30 In reply to 33245.29 

Thanks Kenny, your help was much appreciated earlier.

 

Will try that Fri as Off up North to Wick and Elgin tomorrow so cant try till Friday.

 

Many Thanks
Kev

0/0
 Reply   Quote More 

 From:  Mod_Inside (MODINSIDE)   
 To:  Kenny J (WINGNUTKJ)     
33245.31 In reply to 33245.29 

Thanks again Kenny that works.

 

Thanks much appreciated.

0/0
 Reply   Quote More 

Reply to All    
 

1–20  21–31

Rate my interest:

Adjust text size : Smaller 10 Larger

Beehive Forum 1.5.2 |  FAQ |  Docs |  Support |  Donate! ©2002 - 2024 Project Beehive Forum

Forum Stats