ip numbers overflow

  • Thread starter Thread starter scott
  • Start date Start date
S

scott

Thought I would do a simple lookup to see where login attempts are
coming from.
Imported table with ip addresses.
I compare the following ip_num to a table to find the block range and
it works fine except....

ip_num: ([A]*16777216)+(*65536)+([C]*256)+[D]

if A is too large I get an overflow. I realize that the datatype needs
to be a Long but so far my attempts to use CLng haven't helped.

Thought this would be a simple thing.

Any ideas.
Thanks,
Scott
 
Because it uses short integers. Try:

ip_num: ([A]*CDEC(16777216))+(*CDEC(65536))+([C]*CDEC(256))+[D]
 
Actually, you are probably going to have to use floating point numbers CDbl
to prevent the overflow.
[A]*CDbl(16777216) and see if you still have the overflow problem.

--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..
 
You *may* get rounding error using a double-floating point arithmetic (kind
of 0.99999999, or 0.000000001) when you convert back to integers, if you do.
Using CDec rather than CDbl, CDec giving a large integer, won't get that
problem.


Vanderghast, Access MVP
 
Back
Top