G
Guest
I have a form that I want to have use a disconnected recordset. The
disconnected recordset works fine, but I am unable to update or even type in
the textboxes. When I try I get a "Recordset is not updateable message"
My intention is to have the recordset reconnected and for it to do a batch
update when the client pushes the "Save" button.
I know I could have the text boxes unbound, load the values from the
disconnected recordset, then disconnect. And reconnect and load the values
back in to the recordset to save, but that seems to be a lot of extra work.
Below is the code I'm using to load my recordset. Does anyone have any ideas
on where I'm going wrong?
'*****************************
Private Sub UpdateRecordSource_New()
Dim cnn As New ADODB.Connection
Dim cmd As New ADODB.Command
Dim rst As New ADODB.Recordset
On Error GoTo ErrHandler:
cnn.Open GetStrConnect
rst.CursorLocation = adUseClient
rst.CursorType = adOpenStatic
rst.LockType = adLockBatchOptimistic
Set cmd.ActiveConnection = cnn
cmd.CommandText = "rs_Students_version_8"
cmd.CommandType = adCmdStoredProc
cmd.Parameters.Refresh
cmd.Parameters("@iIntakeID") = 3304
rst.Open cmd
Set Me.Recordset = rst
rst.Close
cnn.Close
Set rst = Nothing
Set cnn = Nothing
Set cmd = Nothing
Exit Sub
ErrHandler:
MsgBox Err.Description
Resume Next
End Sub
disconnected recordset works fine, but I am unable to update or even type in
the textboxes. When I try I get a "Recordset is not updateable message"
My intention is to have the recordset reconnected and for it to do a batch
update when the client pushes the "Save" button.
I know I could have the text boxes unbound, load the values from the
disconnected recordset, then disconnect. And reconnect and load the values
back in to the recordset to save, but that seems to be a lot of extra work.
Below is the code I'm using to load my recordset. Does anyone have any ideas
on where I'm going wrong?
'*****************************
Private Sub UpdateRecordSource_New()
Dim cnn As New ADODB.Connection
Dim cmd As New ADODB.Command
Dim rst As New ADODB.Recordset
On Error GoTo ErrHandler:
cnn.Open GetStrConnect
rst.CursorLocation = adUseClient
rst.CursorType = adOpenStatic
rst.LockType = adLockBatchOptimistic
Set cmd.ActiveConnection = cnn
cmd.CommandText = "rs_Students_version_8"
cmd.CommandType = adCmdStoredProc
cmd.Parameters.Refresh
cmd.Parameters("@iIntakeID") = 3304
rst.Open cmd
Set Me.Recordset = rst
rst.Close
cnn.Close
Set rst = Nothing
Set cnn = Nothing
Set cmd = Nothing
Exit Sub
ErrHandler:
MsgBox Err.Description
Resume Next
End Sub