Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   Index   Templates   Seminars   TechHelp   Forums   Help   Contact   Join   Order   Logon  
 
Home > TechHelp > Directory > Access > IP Addresses < Split Function | Change From Previous >
Back to IP Addresses    Comments List
Upload Images   Link   Email  
How to Search by IP Address
Dan Pickle 
     
2 years ago
Please bear with me as I am new to Access but I need to know how to build a DB where I can put in IP addresses and search by those addresses.  Obviously I cannot just format a column as a number since an IP address has 3 decimals in it such as 192.168.1.1
Colin Levy 
       
2 years ago
Hi Dan

I only set a field as a number type if I intend to be able to do something mathematic with it. For example I would store 'quantity' as a number because I might need to work out a sum of quantities. But I would store a telephone number as short text because we don't normally do math on telephone numbers.

Likewise it's unlikely you would need to do math on the IP addresses. So I would store them in a field with type short text.
Colin Levy 
       
2 years ago
Sorry - hit submit a bit early. I was going to add - if I really wanted to be able to do any sort of calculations with an IP address, I would split it into the 4 octets in 4 separate fields.
Hope this helps, Colin.
Kevin Robertson 
           
2 years ago
I agree with Colin. Store the IP Address as Short Text.
Here is one way to search for a specific IP Address (see screenshot).
Kevin Robertson 
           
2 years ago

Dan Pickle OP 
     
2 years ago
Cool!  I'll give that a try tomorrow at work!
Dan Jackson 
            
2 years ago
Also try Search Form 2.0. Simplify it down for your needs!
Dan Pickle OP 
     
2 years ago
So I did try that today but sorting doesn't work correctly  Sorting goes from 192.168.1.1 to 192.168.1.10 to 192.168.1.100 before it gets to 192.168.1.2
Dan Pickle OP 
     
2 years ago
and search form 2.0 is AWESOME!  I already used it on another project and it works GREAT
Dan Jackson 
            
2 years ago
Yeah, sorting wont work for your intention because its done as a string.

When the sorting treats it as a string, it goes:

1
10
11
12
. . .
19
2
20
21
22
. . .
29
3
30

And so on.

To sort correctly, it would need to be designated as a number (This is one of those mathematical things Colin was talking about). As he says, if you wanted complete control and 100% properly done, you would need to store each "Part" of the IP in a separate box. You could then use Concatenation in your search 2.0 form to display it as intended.

Something like
IP1 & "." & IP2 & "." & IP3 & "." & IP4
Would Produce 192.168.0.1 from the 4 separate boxes and enable to you sort alpha numerically
Dan Jackson 
            
2 years ago
Yeah, I've only actually done 2 major releases and both used Search Form 2.0. Plus a bunch a smaller DB's for myself
Kevin Robertson 
           
2 years ago
You beat me to it Dan. LOL Took too long putting an image together. 😁
Kevin Robertson 
           
2 years ago

Dan Jackson 
            
2 years ago
Its Happenening! I'm becoming a pro!!!!
Dan Pickle OP 
     
2 years ago
If I split up the IP address into 4 cells though there would be no way to assign no duplicates to the field to make sure the same address is not used as a static address somewhere in our network
Alex Hedley 
            
2 years ago
{Composite Key}
Dan Jackson 
            
2 years ago
What Alex is referring to is Composite Keys

Essentially, you'd set all the required fields into a single indexed field (Called a composite key) which can then be dupe checked

This thread is now CLOSED. If you wish to comment, start a NEW discussion in IP Addresses.
 

 
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2025 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 1/23/2025 9:10:18 AM. PLT: 1s