How to use the "ping" for an ip in the text box?

I

Imran

I am designing a database for the data center of a bank. on the form i have a
text box with the IP address in it. How can i add a button in front of it to
ping that IP address?
 
D

Dirk Goldgar

Imran said:
I am designing a database for the data center of a bank. on the form i have
a
text box with the IP address in it. How can i add a button in front of it
to
ping that IP address?


What do you want to do with the results of the ping? One quick and dirty
way would be like this:

'------ start of button code -------
Private Sub cmdPing_Click()

If IsNull(Me.txtIPAddress) Then
DoCmd.Beep
Else
Shell "ping.exe " & Me.txtIPAddress, vbNormalFocus
End If

End Sub
'------ end of button code -------

That will do the ping in a command window, which will close as soon as the
command is executed. If that approach is okay, but you want the command
window to stay open, you can do this instead:

Shell "cmd /k ping.exe " & Me.txtIPAddress, vbNormalFocus

If you need to programmatically process the output of the ping, you could
probably set up the command line to redirect the output to a file, then read
that file to see what happened.
 
I

Imran

It worked. You r great.
thanks a lot


Dirk Goldgar said:
What do you want to do with the results of the ping? One quick and dirty
way would be like this:

'------ start of button code -------
Private Sub cmdPing_Click()

If IsNull(Me.txtIPAddress) Then
DoCmd.Beep
Else
Shell "ping.exe " & Me.txtIPAddress, vbNormalFocus
End If

End Sub
'------ end of button code -------

That will do the ping in a command window, which will close as soon as the
command is executed. If that approach is okay, but you want the command
window to stay open, you can do this instead:

Shell "cmd /k ping.exe " & Me.txtIPAddress, vbNormalFocus

If you need to programmatically process the output of the ping, you could
probably set up the command line to redirect the output to a file, then read
that file to see what happened.

--
Dirk Goldgar, MS Access MVP
Access tips: www.datagnostics.com/tips.html

(please reply to the newsgroup)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top