<< Click to Display Table of Contents >>
GetADORecordSet |
1.On the initial Screen, insert a Query object named as "DeviceQuery".
2.Configure this Query to access the ConfigDevice table and return the Device, Port, and IP fields.
3.On the initial Screen, add a Command Button. On the Click event of this object, insert the next script.
Set port = Application.GetObject("Driver1.[IO.Ethernet.MainPort]")
Set driver = Application.GetObject("Driver1")
'Access the ConfigDevice table
Set qryDevice = Screen.Item("QueryDevice").GetADORecordset()
'Moves the pointer to the last record
qryDevice.MoveLast
'Traverses the whole table
For i = 1 To qryDevice.RecordCount
device = qryDevice.Fields("Device").Value & "|" & device
'Moves to the previous record
qryDevice.MovePrevious
Next
'Displays the name of all registered devices
op = Application.SelectMenu(device)
'Moves to the first record
qryDevice.MoveFirst
For i = 1 To qryDevice.RecordCount
'Checks if the table's row contains the name of the selected device
If i = op Then
'Sets this Driver to the Offline mode
driver.Write -1, 0, 0, 4, 0
'Changes the TCP/IP port
port.WriteEx qryDevice.Fields("Port").Value
'Sets this Driver to the Online mode
driver.Write -1, 0, 0, 4, 1
End If
qryDevice.MoveNext
Next
4.Execute the application and test this new functionality.