overflow error

A

AMC

Hi,

I'm using Access 2000. I have the simple lines of code below. Everytime this
code runs I get an overflow error?
Is this a bug in Access 2000? The result of the below calculation is
2903147433 and I thought the range of size for currency
was -922,337,203,685,477.5808 to 922,337,203,685,477.5807. Any help would be
appreciated!

Dim c As Currency
c = 45909 * 63237
 
V

Van T. Dinh

Since the 2 factors can be stored as Long, Access / VBA assumes the result
is Long. Use CCur to change either or both to Currency type:

c = CCur(45909) * CCur(63237)
 

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

Top