Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Get Gateway IP address 1

Status
Not open for further replies.

Checking

Technical User
Nov 27, 2003
26
BE
Implemented MSAccess Application with Backend (residing on company's intranet)& FrontEnds (per User). I want to be shure that users only can connect to the backend when they are physically in the office (thus directly connected to the intranet). So, If they are in the office starting up their local front-ends I want an IP-validation on the connected gateway before connecting to the backend. If they work remotely, they will be connected through a different gateway not allowing them to connect to the backend.
Does anybody can give me a hint as how to catch a gatewayIP address through code ?

Thks in advance !!
Checking

Belgium
 
You may use the following function created in a standard code module:
Code:
Public Function getMyGatewayIP()
Dim myWMI As Object, myobj As Object, itm
Set myWMI = GetObject("winmgmts:\\.\root\cimv2")
Set myobj = myWMI.ExecQuery("Select * from Win32_NetworkAdapterConfiguration Where IPEnabled = True")
For Each itm In myobj
  getMyGatewayIP = itm.DefaultIPGateway(0)
  Exit Function
Next
End Function

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks very much PHV; works even better !!! Briljant.
Rgds frm

Belgium
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top