Search for IP ranges query, URGENT!

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi people,

I have the table with ip range, columns "start ip" and "end ip", site id.
I run the query to find out if the IP fits into range. If it is positive
then return the IP range and site code.
I have tested it with 6 various IPs address and not every IP I supply
returns IP range and site code. If I go to look up that IP manualy, the range
is there for that IP. But by some reason it does not return the range.
My query is:
SELECT Trim([Enter IP here]) AS Searched_IP, sites_ipranges.FirstIP,
sites_ipranges.LastIP, sites_ipranges.SiteID,
FROM sites_ipranges
WHERE (((Trim([Enter IP here])) Between [sites_ipranges]![FirstIP] And
[sites_ipranges]![LastIP]))

Please ask questions and help to find a solution,

Thanks a lot,

Sergei
 
HI,


Sure, as in

? EVAL( " 'X' BETWEEN 'A' AND 'Z' " )


or as in


? EVAL( " 100 BETWEEN 10 AND 1000 " )



Hoping it may help,
Vanderghast, Access MVP


Geof Wyght said:
The Between operator works for non-date fields?
Geof Wyght
-----Original Message-----
Hi people,

I have the table with ip range, columns "start ip" and "end ip", site id.
I run the query to find out if the IP fits into range. If it is positive
then return the IP range and site code.
I have tested it with 6 various IPs address and not every IP I supply
returns IP range and site code. If I go to look up that IP manualy, the range
is there for that IP. But by some reason it does not return the range.
My query is:
SELECT Trim([Enter IP here]) AS Searched_IP, sites_ipranges.FirstIP,
sites_ipranges.LastIP, sites_ipranges.SiteID,
FROM sites_ipranges
WHERE (((Trim([Enter IP here])) Between [sites_ipranges]! [FirstIP] And
[sites_ipranges]![LastIP]))

Please ask questions and help to find a solution,

Thanks a lot,

Sergei



.
 
Hi,



The test will be alphanumerical, meaning you have to enter
067.126.017.123, not 67.126.17.123

Alphanumerically, "az" is before "b", so "az" is between "a" and "b".
In the very same way, "19" comes before "2", or, if you prefer, "19" is
between "1" and "2". If you use three digits for each octet, you won't fall
on the problem, but otherwise, I am afraid you are doomed, since your
comparison of between-ness will be made character by character (and the
shorter one may win).



Hoping it may help,
Vanderghast, Access MVP
 
Neat!
-----Original Message-----
HI,


Sure, as in

? EVAL( " 'X' BETWEEN 'A' AND 'Z' " )


or as in


? EVAL( " 100 BETWEEN 10 AND 1000 " )



Hoping it may help,
Vanderghast, Access MVP


The Between operator works for non-date fields?
Geof Wyght
-----Original Message-----
Hi people,

I have the table with ip range, columns "start ip" and "end ip", site id.
I run the query to find out if the IP fits into range. If it is positive
then return the IP range and site code.
I have tested it with 6 various IPs address and not
every
IP I supply
returns IP range and site code. If I go to look up that IP manualy, the range
is there for that IP. But by some reason it does not return the range.
My query is:
SELECT Trim([Enter IP here]) AS Searched_IP, sites_ipranges.FirstIP,
sites_ipranges.LastIP, sites_ipranges.SiteID,
FROM sites_ipranges
WHERE (((Trim([Enter IP here])) Between
[sites_ipranges]!
[FirstIP] And
[sites_ipranges]![LastIP]))

Please ask questions and help to find a solution,

Thanks a lot,

Sergei



.


.
 
Back
Top