Solved

Create an IP address lookup in an Access Form

Posted on 2013-06-12
3
392 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
Comment Utility
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 39

Accepted Solution

by:
als315 earned 250 total points
Comment Utility
Try this sample
DBIP.accdb
0
 

Author Closing Comment

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

Featured Post

Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

Join & Write a Comment

QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

772 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now