Logo
English Russian German French Spanish Italian
contact usprivacy
   Support Forums
chart
• About the product
• Download
• Sample projects:
Using with VB
Using with ASP
Using with VBScript
Using with MS Access
Using with C#
• Support Forum
ICMP Component - Samples (Using in MS Access)

Using OstroSoft ICMP component (OSICMP.dll) in MS Access
This sample will work in all MS Office applications, supporting VBA
Download sample database (Access 2000)

Minimum requirements: OSICMP.dll*
* If you don't have OstroSoft ICMP Component, see installation instructions

1. Open Access database, go to Forms tab and create a new Form.
2. Add textbox txtHost, 8 textboxes txt1-txt8, command button cmdPing.
3. Right-click cmdPing and select "Buld Event".
4. In VBA editor select Tools menu, then References submenu.
5. From the list of references select and check OSICMP, click OK button to save changes.
6. Enter the following code:

Option Compare Database

Private Sub cmdPing_Click()
  Dim oPing As New OSICMP.ping
  Dim i As Integer 'request counter
  Dim s As String
  Dim t As TextBox
  
On Error GoTo err_handler:
 
  For i = 1 To 8
    Set t = Controls("txt" & i)
    t.SetFocus
    t.Text = ""
  Next
 
  For i = 0 To 3
    txtHost.SetFocus
    oPing.Send txtHost.Text
    
    If i = 0 Then
      txtHost.SetFocus
      If txtHost.Text <> oPing.IP Then s = txtHost.Text & _
        " [" & oPing.IP & "]" Else s = txtHost.Text
      
      txt1.SetFocus
      txt1.Text = "Pinging " & s & " with " & _
        oPing.PacketSize & " bytes of data:"
      txtHost.SetFocus
    End If
    
    Set t = Controls("txt" & i + 3)
    t.SetFocus
    t.Text = "Reply from " & _
      oPing.IP & ": bytes=" & oPing.PacketSize & " time=" & _
      oPing.RoundTripTime & "ms TTL=" & oPing.TTL
    txtHost.SetFocus
    
    oPing.Sleep 1000
  Next
  
  txt8.SetFocus
  txt8.Text = "complete"
  txtHost.SetFocus
  Exit Sub
  
err_handler:
  txt8.SetFocus
  txt8.Text = "Error " & Err.Number & ": " & Err.Description
  txtHost.SetFocus
End Sub

Copyright © 1996-2008 OstroSoft. All rights reserved. info@ostrosoft.com