Solved

Create an IP address lookup in an Access Form

Posted on 2013-06-12
3
426 Views
Last Modified: 2013-06-18
Hello...I would like to build a Form in Access 2010 and code it to lookup the IP address and return any available information. See the picture below for an idea. I know I can write and shell a .bat file using the nslookup CMD. I just need to find out how to read the return info into a text box in the form... or if you know of an easier method please suggest it!

0
Comment
Question by:Jeffrey Reep
3 Comments
 
LVL 28

Assisted Solution

by:omgang
omgang earned 250 total points
ID: 39241985
Try this function
OM Gang



Public Function GetIPAddy() As String
On Error GoTo Err_GetIPAddy

    Dim oAdapter As Object, oNic As Object
    Dim strIP As Variant

    Set oAdapter = GetObject("winmgmts:").InstancesOf("Win32_NetworkAdapterConfiguration")

    For Each oNic In oAdapter
        If oNic.IPEnabled Then
            strIP = oNic.IPAddress(0)
        End If
    Next
   
Exit_GetIPAddy:
    GetIPAddy = strIP
    Set oNic = Nothing
    Set oAdapter = Nothing
    Exit Function

Err_GetIPAddy:
    MsgBox Err.Number & " (" & Err.Description & ") in procedure GetIPAddy of Module Module3"
    Resume Exit_GetIPAddy

End Function
0
 
LVL 40

Accepted Solution

by:
als315 earned 250 total points
ID: 39242009
Try this sample
DBIP.accdb
0
 

Author Closing Comment

by:Jeffrey Reep
ID: 39257749
Both good starts... with some modification they are perfect. Thanks!
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

790 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question