briansmithdanisco
IS-IT--Management
I have a module that does a select and returns a resultset with 1 to many records. I loop through the records and do some time calculations. I need to update each of the recrods in the resultset with the correct calculated time. I think I need to set the LockType to adLockOptimistic, but when I do, I still get the error that my resultset is read only.
Can anyone suggest where to put the LockType line so I am able to update the resultset data?
Here is an example of my SELECT. I have tried several combinations of SET commands, but nothing seems to be working.
Dim cmd As ADODB.Command
Dim rst As ADODB.Recordset
Set cmd = New ADODB.Command
rst.LockType = adLockOptimistic
' Get all the on-stream records for this batch number.
With cmd
.ActiveConnection = CurrentProject.Connection
.CommandText = "Select * from tblOnStreamTime " & _
"Where '" & Me.MainBatchNumber.Value & "' = tblOnStreamTime.MainBatchNumber;"
.CommandType = adCmdText
.Prepared = True
Set rst = .Execute
End With
After I do some calculations I try to update the time value in the resultset with the calculated time:
rst!TotalTimeDetail = dteTimeCalc
rst.Update
Any suggestions would be appreciated.
Thanks.
Can anyone suggest where to put the LockType line so I am able to update the resultset data?
Here is an example of my SELECT. I have tried several combinations of SET commands, but nothing seems to be working.
Dim cmd As ADODB.Command
Dim rst As ADODB.Recordset
Set cmd = New ADODB.Command
rst.LockType = adLockOptimistic
' Get all the on-stream records for this batch number.
With cmd
.ActiveConnection = CurrentProject.Connection
.CommandText = "Select * from tblOnStreamTime " & _
"Where '" & Me.MainBatchNumber.Value & "' = tblOnStreamTime.MainBatchNumber;"
.CommandType = adCmdText
.Prepared = True
Set rst = .Execute
End With
After I do some calculations I try to update the time value in the resultset with the calculated time:
rst!TotalTimeDetail = dteTimeCalc
rst.Update
Any suggestions would be appreciated.
Thanks.