Normal Topic Can't divide (Read 1173 times)
Leezerd
Member
*
Offline


I wish I had a better
picture than this...

Posts: 49
Joined: Aug 23rd, 2004
Can't divide
Oct 12th, 2004 at 6:56pm
Print Post Print Post  
I am programming a report and I get an error that says:

Error while parsing module " LE31 (0) "
Type mismatch error ( operation is not defined for the types of the opperands
Line 1, position 12 : /
le31 = le30/le10
                                                                     ^

Any help?
  

How can you be in two places at once when you're not anywhere at all.
Back to top
 
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Can't divide
Reply #1 - Oct 12th, 2004 at 7:13pm
Print Post Print Post  
Are LE10 and LE30 bound to numeric or money fields? You can't divide with text.

You can try something like this:

Code
Select All
If @ToNumber(LE10) > 0   // Never divide by zero!
{
  LE31 = @ToNumber(LE30) / @ToNumber(LE10)
}
Else
{
  LE31 = 0
} 

  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
Leezerd
Member
*
Offline


I wish I had a better
picture than this...

Posts: 49
Joined: Aug 23rd, 2004
Re: Can't divide
Reply #2 - Oct 12th, 2004 at 7:41pm
Print Post Print Post  
The le's were "money" bound to text fields.  Changed them to money and everything is a.o.k.  Thanks
  

How can you be in two places at once when you're not anywhere at all.
Back to top
 
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Can't divide
Reply #3 - Oct 12th, 2004 at 7:57pm
Print Post Print Post  
Quote:
The le's were "money" bound to text fields.  Changed them to money and everything is a.o.k.  Thanks


Good! You do still want to check that your bottom number (the divisor) is not zero before doing your division, though. Otherwise, if LE10 is ever blank or zero, you will get a runtime error.
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged