Recordset not updatable
From: Brandon (bkc5_at_cdc.gov.removeme)
Date: 04/26/04
- Next message: allie: "Repair and compact"
- Previous message: Gerald Stanley: "Re: After Update doesn't"
- Next in thread: Gerald Stanley: "Re: Recordset not updatable"
- Reply: Gerald Stanley: "Re: Recordset not updatable"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 26 Apr 2004 04:46:04 -0700
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: allie: "Repair and compact"
- Previous message: Gerald Stanley: "Re: After Update doesn't"
- Next in thread: Gerald Stanley: "Re: Recordset not updatable"
- Reply: Gerald Stanley: "Re: Recordset not updatable"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|