[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 445
  • Last Modified:

Create an IP address lookup in an Access Form

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
Jeffrey Reep
Asked:
Jeffrey Reep
2 Solutions
 
omgangCommented:
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
 
als315Commented:
Try this sample
DBIP.accdb
0
 
Jeffrey ReepCapacity Planning AnalystAuthor Commented:
Both good starts... with some modification they are perfect. Thanks!
0

Featured Post

Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now