These are the variables and system function which need to be declared in a Module or the Delceration area of a form:

Private Const MAX_IP = 5 'To make a buffer

Private Type IPINFO
dwAddr As Long ' IP address
dwIndex As Long ' interface index
dwMask As Long ' subnet mask
dwBCastAddr As Long ' broadcast address
dwReasmSize As Long ' assembly size
unused1 As Integer ' not currently used
unused2 As Integer '; not currently used
End Type

Private Type MIB_IPADDRTABLE
dEntrys As Long 'number of entries in the table
mIPInfo(MAX_IP) As IPINFO 'array of IP address entries
End Type

Private Type IP_Array
mBuffer As MIB_IPADDRTABLE
BufferLen As Long
End Type

Dim x1a0(9) As Long
Dim cle(17) As Long
Dim x1a2 As Long
Dim inter As Long, res As Long, ax As Long, bx As Long
Dim cx As Long, dx As Long, si As Long, tmp As Long
Dim I As Long, c As Byte

Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (DESTINATION As Any, Source As Any, ByVal LENGTH As Long)
Private Declare Function GetIpAddrTable Lib "IPHlpApi" (pIPAdrTable As Byte, pdwSize As Long, ByVal Sort As Long) As Long

FUNCTIONS USED TO RETREIVE THE IP
---------------------------------------------------------
Private Function ConvertAddressToString(longAddr As Long) As String

Dim myByte(3) As Byte
Dim Cnt As Long

CopyMemory myByte(0), longAddr, 4

For Cnt = 0 To 3

ConvertAddressToString = ConvertAddressToString + CStr(myByte(Cnt)) + "."

Next Cnt

ConvertAddressToString = Left$(ConvertAddressToString, Len(ConvertAddressToString) - 1)

End Function

Private Function ReturnMachineIP() As String

On Error GoTo ErrorFunction

Dim ReturnedIPs As Long
Dim bBytes() As Byte
Dim Listing As MIB_IPADDRTABLE
Dim IPList As Integer

GetIpAddrTable ByVal 0&, ReturnedIPs, True

If ReturnedIPs <= 0 Then GoTo ErrorFunction

ReDim bBytes(0 To ReturnedIPs - 1) As Byte

GetIpAddrTable bBytes(0), ReturnedIPs, False
CopyMemory Listing.dEntrys, bBytes(0), 4

For IPList = 0 To Listing.dEntrys - 1

CopyMemory Listing.mIPInfo(IPList), bBytes(4 + (IPList * Len(Listing.mIPInfo(0)))), Len(Listing.mIPInfo(IPList))

If ((ConvertAddressToString(Listing.mIPInfo(IPList).d wMask) = "255.255.255.0") And (Right(ConvertAddressToString(Listing.mIPInfo(IPLi st).dwAddr), 6) <> ".0.0.0")) Then

ReturnMachineIP = ConvertAddressToString(Listing.mIPInfo(IPList).dwA ddr)
Exit Function

End If

Next IPList

ErrorFunction:

Err.Clear
Responce = MsgBox("Unable to obtain IP information.", vbCritical)
DoCmd.Quit

End Function