here is a way to do it, if the the format of the IPX address is "A5E6C090"
There are two functions. the first function I created and the second is from MSDN.
You may want to add some error checking...
-----
Public Function ConvertIPXtoIP(IPX As String) As String
'accepts IPX Networt number e.g. "A5E6C090"
'Return equivalant IP number e.g. "165.230.192.144"
Dim lng As Long
Dim strIP As String
strIP = ""
For lng = 1 To 8 Step 2
If lng = 1 Then
strIP = HexToLong(Mid(IPX, lng, 2))
Else
strIP = strIP & "." & HexToLong(Mid(IPX, lng, 2))
End If
Next lng
ConvertIPXtoIP = strIP
End Function
Function HexToLong(ByVal sHex As String) As Long
'see website:
Thanks for the reply. The IPX networks are in the format of 12AB3C4D. In your 2nd response you posted what looks to be the exact code I am looking for, only thing is I am not too saavy on VB. Can you explain how I can build this into my form, creating a field in design view and when and where to place the code. By looking at the code above, you are on it, that is exactly the result I'm looking for.
1. Copy and paste the two functions into a module.
2. Create a new form. In design view add two textboxes. Call the first textbox "txtIPX" and the second "txtIP". Also add a command button and call it cmdConvert.
3. Now, on the On_Click event of the 'cmdConvert' button, put in the following code (within the forms class module).
---------
Private Sub cmdConvert_Click()
On Error GoTo errConvert
'check txtIPX field contains a 32 bit network address
If Len(txtIPX) <> 8 Then '<--this only check that the IPX has 8 characters (ie simple check)
MsgBox "IPX field does not contain 8 characters"
Me.txtIP = "Unable to convert"
GoTo CleanUp
End If
'do the conversion
Me.txtIP = ConvertIPXtoIP(Trim$(Me.txtIPX.Value))
This example illustrates how to implement the function. Of course, there are many other ways to use it, e.g., put the code on the after_update event of the txtIP field, thus you won't need a command button.
let me know if you want me to clearify anything further.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.