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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Button to ping whats in a field

Status
Not open for further replies.

weezy6902

IS-IT--Management
Jun 2, 2003
46
0
0
US
Hey guys,
Im sure you know how to do this so I am asking for your help. I have an inventory form I put together and it has a field where the user can input the computer machine name in. I want to add a button that will start a ping in a command prompt so that the user will be able to verify the machine names existance at the click of a button.

Anyone know how to do this?

Thanks,

Ben
 
I've never tried something like this, but I would imagine the best place to start would be using the Windows Script Host. You have to set a reference to it, and then you can access what you need for that, I think.
 
well thanks for the reply at lease. I was hoping someone has done this already and may have more detailed info as to exactly how i scrape whatever data from a field and use it in a command.
 
Well, I do know of a way to do it in VBA, but it is occasionally error prone.

You can use the VBA Function, SendKeys. But if there may be any chances of a wrong keystroke messing up anything, I'd stay away from it.

I've also used a custom function created by a Micrsoft MVP, Dev Ashish, called MySendKeys that works better, but I still had some errors with it as well. The API calls would be the best one to go with if you wanted to do something like that.

I found it here:
[URL unfurl="true"]http://www.mvps.org/access/api/api0046.htm[/url]
 
What you would do is insert the code from the above link into a module, and make calls to the MySendKeys function after opening the CMD application using the Shell function, already built into VBA. If you want more details, you can pull up the help file for "SendKeys", and you'll see what I'm talking about.

The MySendKeys works practically identically to SendKeys, as far as making use of it in your database.
 
sendkeys cool at least thats a start for me to look into!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top