jal
01-02-2009, 01:57 AM
MsgBox 437 * 100
How then does one multiply two numbers in VBA?
How then does one multiply two numbers in VBA?
|
View Full Version : Overflow? jal 01-02-2009, 01:57 AM MsgBox 437 * 100 How then does one multiply two numbers in VBA? jal 01-02-2009, 02:02 AM Okay, you have to use CLng around one of the numbers. Solved. Atomic Shrimp 01-02-2009, 02:10 AM It works for smaller values - I believe you're getting the overflow error because Access is trying to work it out using assumed data types (short integers, I think) that turn out inadequate for the task. The Clng (convert to long integer) function should make it work. MsgBox Clng(437) * Clng(100) Returns '43700' lagbolt 01-02-2009, 10:12 AM You can also explicitly enforce a type on a number using one of the following suffixes... ? typename(1!) Single ? typename(1@) Currency ? typename(1#) Double ? typename(1%) Integer ? typename(1&) Long jal 01-02-2009, 07:26 PM You can also explicitly enforce a type on a number using one of the following suffixes... ? typename(1!) Single ? typename(1@) Currency ? typename(1#) Double ? typename(1%) Integer ? typename(1&) Long Interesting. I was wondering if there was a way to do that. Thanks. |