Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.databases.ms-access > #10820

Re: Recordsetclone edit problem

From "Ron Paii" <None@none.com>
Newsgroups comp.databases.ms-access
Subject Re: Recordsetclone edit problem
Date 2015-06-12 15:35 -0500
Organization A noiseless patient Spider
Message-ID <mlffok$apr$1@dont-email.me> (permalink)
References <ec3bf158-83e6-4675-8d5b-e410311c02fc@googlegroups.com>

Show all headers | View raw



"Patrick Finucane" <patrickfinucanetx@gmail.com> wrote in message 
news:ec3bf158-83e6-4675-8d5b-e410311c02fc@googlegroups.com...
> Access 2013.  I have a form/subform.  The Main form is unbound/the subform 
> a datasheet.  In the datasheet I have a Yes/No field called Selected.  It 
> is the only one that is modified.  I then click on a command button to 
> process records that are Selected = True.  At the end of the process, I 
> want to set Selected back to False.
>
> When I press the Select button, the after Update even is
>  Me.Dirty = False
> because of the error I get
>
>  I will present some of my code.
>
>    Dim rst As Recordset
>    Set rst = Me.InvoiceCreditReverseDS.Form.RecordsetClone
>    rst.FindFirst "Selected = True"
>    If Not rst.NoMatch Then
>       'here I process data and update other tables then I do some overkill
>
>       'overkill start
>       lngID = rst!AccountsID
>       rst.Close
>       Set rst = Me.InvoiceCreditReverseDS.Form.RecordsetClone
>       rst.FindFirst "AccountsID = " & lngID
>
>       'overkill end
>       rst.Edit
>       rst!Selected = False
>       rst!Credit_Note = "Reversed. " & rst![Credit_Note]
>       rst.Update
>    end if
>
>
> Originally I just did stuff from the rst.Edit line.  Then I went and did 
> overkill and closed the recordset and reopened it, found the record again, 
> and attempted to edit it.
>
> Why?  Because I keep getting an Error 3197; The MS Access database engine 
> stopped the process because you or another are attempting to change the 
> same data....whether or not I do overkill.
>
> I have scoured my code.  In no place while processing the data have I 
> attempted to update rst. I have used rst fields to update other table 
> fields.  The only place I have attempted to modify/update rst is where I 
> have rst.Edit and that gives me the error.
>
> When I had just rst.Edit (not proceeding lines to close and open it), I 
> couldn't step past rst.Edit.  When Close and Reopen, it bombs out on 
> rst.Edit but I can step thru it to the next line.  Totally weird.
>
> Can you see anything I am doing wrong?
>

Using "rst.Close" on a clone will cause problems. Clone does not open a new 
record set. use "Set rst = nothing".

Try using "me.dirty = false" (saving any changes to the current record) 
before cloning the recordset. 

Back to comp.databases.ms-access | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Recordsetclone edit problem Patrick Finucane <patrickfinucanetx@gmail.com> - 2015-06-12 09:01 -0700
  Re: Recordsetclone edit problem "Phil" <phil@stantonfamily.co.uk> - 2015-06-12 18:33 +0100
    Re: Recordsetclone edit problem Patrick Finucane <patrickfinucanetx@gmail.com> - 2015-06-12 10:48 -0700
  Re: Recordsetclone edit problem Ulrich Möller <knobbi38@arcor.de> - 2015-06-12 20:18 +0200
    Re: Recordsetclone edit problem Patrick Finucane <patrickfinucanetx@gmail.com> - 2015-06-12 12:47 -0700
  Re: Recordsetclone edit problem "Ron Paii" <None@none.com> - 2015-06-12 15:35 -0500

csiph-web