Re: Recordset not updatable
From: Gerald Stanley (gcstanley_at_d-s-l.pipex.com)
Date: 04/26/04
- Next message: BLM: "RE: Repost: Requery Subform"
- Previous message: Aaron: "Update or Cancelupdate without Addnew or Edit"
- In reply to: Brandon: "Recordset not updatable"
- Next in thread: Brandon: "Re: Recordset not updatable"
- Reply: Brandon: "Re: Recordset not updatable"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 26 Apr 2004 06:19:06 -0700
Instead of
Set RecSet = cmd.Execute
Try
RecSet.Open cmd,,adOpenDynamic,adLockOptimistic
Hope This Helps
Gerald Stanley MCSD
>-----Original Message-----
>Hello,
>
>I found a help file that shows an ado recordset object
being applied to a forms recordset. I tried the example and
everything worked except that I would not allow writing the
data back to the database. I have included the following code.
>
> Dim RecSet As ADODB.RecordSet
> Dim cn As ADODB.Connection
> Dim cmd As ADODB.Command
> Dim param As ADODB.Parameter
>
> Set cn = CurrentProject.Connection
> Set cmd = New ADODB.Command
> With cmd
> .ActiveConnection = cn
> .CommandType = adCmdStoredProc
> .CommandText = "sproc_inventory"
> End With
>
> Set param = New ADODB.Parameter
> With param
> .name = "Item"
> .TYPE = adVarChar
> .Value =sValue
> .Direction = adParamInput
> .Size = 10
> End With
> cmd.Parameters.Append param
>
> Set RecSet = New ADODB.RecordSet
> With RecSet
> .LockType = adLockOptimistic
> .CursorType = adOpenDynamic
> .CursorLocation = adUseClient
> End With
>
> Set RecSet = cmd.Execute
> Set forms("formname").RecordSet = RecSet
> Set cn = Nothing
> Set cmd = Nothing
> Set param = Nothing
>
>According to the help file, I should be able to read and
write. I can only read the recordset. I get the following
error:
>Field is based on an expression and can't be edited. The
store procedure is has several joins. I know the SPROC will
work because I switched it to the recordsource and I was
able to read and write. I would prefer using the ado code.
>
>Thank you,
>
>Brandon
>.
>
- Next message: BLM: "RE: Repost: Requery Subform"
- Previous message: Aaron: "Update or Cancelupdate without Addnew or Edit"
- In reply to: Brandon: "Recordset not updatable"
- Next in thread: Brandon: "Re: Recordset not updatable"
- Reply: Brandon: "Re: Recordset not updatable"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|