When I run this script I get the error: Rowset does not support fetching backward.
This error occurs when I try to use the Rst.MoveLast command but I was under the impression that I could do this if I had opened the record set as "Rst.CursorType = adOpenDynamic" obviously I am doing something wrong here can someone point me in the right direction please.
VB Code:
Dim CN As New ADODB.Connection Dim Cmd As New ADODB.Command Dim Rst As New ADODB.Recordset Dim DeviceCount As Integer Dim Count As Integer 'Open DB Connection CN.Open DBPath Set Rst = New ADODB.Recordset Rst.CursorType = adOpenDynamic Rst.Supports (adMovePrevious) 'Prepare the user-defined function statement and execute the command. Cmd.ActiveConnection = CN Cmd.CommandText = "SELECT DeviceName, DeviceType, CMACNum, Address, PLCID, NumEvents, StartRead, StopRead FROM SOEWFC_Definitions;" Set Rst = Cmd.Execute 'Check to see if there are any records in the table If Rst.EOF = False Then 'get number of rows in Backups table Rst.MoveLast DeviceCount = Rst.RecordCount Rst.MoveFirst End If
