Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2004
    Posts
    287

    Unanswered: Pinging from within Access to resolve IP

    I use this Call Shell command to allow a direct IP connection to various devices.

    Code:
    strUrl = [SelectIPAddress]
    Call Shell("explorer.exe " & "http://" & strUrl, 5)
    But I need to take it to the next level and don't know how to do it, as now I would like to add the option of Pinging a PC Name (field <NAME>)

    I would like to use something like this...
    strUrl = [Name]
    Call Shell("ping.exe" & "strUrl, 5)

    And although this opens a command window it closes too fast, so can't tell whether the command is actually working or not

    Any suggestions please? Maybe to keep the command box open or even better just resoilve the IP and print on scree, etc would be a better option.

    Thanks.

  2. #2
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    If it closes that fast, it's not working. Ping takes a little time to run, no matter how fast the network.

    I think you can use a combination of Shell and CMD. I think there is some kind of command line /switch that allows you to do things like run PING.

    Go to your Windows RUN dialog box and type CMD /? and have a look at the options there.
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  3. #3
    Join Date
    Mar 2004
    Posts
    287
    thanks. it works from the run command but when i add this...

    Code:
    strUrl = [Name]
    Call Shell("cmd /k ping" & " " & strUrl, vbNormalFocus)
    It comes up with the dialog box with the error that it can not start as it started CMD.EXE with the user's directory ("My Documents")

    Any suggestions why it's doing this please?

  4. #4
    Join Date
    Mar 2004
    Posts
    287
    or even better i just need to resolve the ip from the pc name and display it

  5. #5
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Curious. It doesn't matter where you run ping from... user's folder or not.

    The code works fine for me. Can you detail the error more?
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •