Recordset not updatable

From: Brandon (bkc5_at_cdc.gov.removeme)
Date: 04/26/04


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



Relevant Pages

  • Re: Temporary Pass-through Query as Rowsource for Listbox?
    ... with each call to get row data, you return the appropriate data from the ... recordset, and in the "finish up" section you close the recordset. ... I think if you look up RowSourceType in the Access 97 help file -- the last ... Dirk Goldgar, MS Access MVP ...
    (microsoft.public.access.formscoding)
  • Re: Simple query/form help?
    ... FindFirst methods of the recordset object. ... Also look at the DLookup function in the Help file to see if you want to use ... > I want to have a way of an end user typing a postcode in such as: ...
    (microsoft.public.access.gettingstarted)
  • Re: Temporary Pass-through Query as Rowsource for Listbox?
    ... The function gets called at various stages in the combo box's querying process, including once to initialize it, once to get the number of rows, and once for each row to be returned. ... So in the initialize section, you'd open a static recordset, and MoveLast and MoveFirst to make sure the RecordCount is known so that you can return it when called to do so. ... Then with each call to get row data, you return the appropriate data from the recordset, and in the "finish up" section you close the recordset. ... I think if you look up RowSourceType in the Access 97 help file -- the last really good help file for Access -- you'll be able to find a help topic explaining how to do it. ...
    (microsoft.public.access.formscoding)
  • Re: Passing a recordset to a form
    ... I notice that a) the Recordset variable is declared as Public* ... The help file says this means that this action is normally ... > Dim rst As New ADODB.Recordset ... > Dim stDocName As String ...
    (microsoft.public.access.formscoding)
  • Re: Disable help file
    ... If you have to look up in the help file for example some basic ... Properties and Methods of the Recordset object, ... steps needed to create even a temporary PTQ dao.querydef by just opening ... situation, if I hadn't done this in Jet for a long time, I'd check help. ...
    (comp.databases.ms-access)