Re: Newbie ADODB.Recordset MoveNext problem

From: Chaim (Chaim_at_discussions.microsoft.com)
Date: 03/18/05


Date: Fri, 18 Mar 2005 07:05:07 -0800

Val,

Why would transaction locks be taken on this code? He's editing a recordset.
Where does the underlying table come in to play? Isn't a recordset all in
memory until an Update?

Just trolling for enlightenment here. I read the link in your post and that
seems to move the question to a different level than I appreciated.

TIA.

"Val Mazur (MVP)" wrote:

> Hi,
>
> What kind of error do you get? See if it helps
>
> http://support.microsoft.com/default.aspx?scid=kb;en-us;286153
>
> --
> Val Mazur
> Microsoft MVP
>
> http://xport.mvps.org
>
>
>
> "f3773t" <f3773t@discussions.microsoft.com> wrote in message
> news:1D9D5FC2-D7E8-4DCC-8013-A3CE680B4EF9@microsoft.com...
> >I have the following function shown below:
> > Now the code executes fine for record sets smaller than MAXLOCKSPERFILE
> > in the system registry.
> > However as soon as the record set is larger than MAXLOCKSPERFILE in the
> > system registry an error occurs.
> >
> > This leads me to think that somewhere in the function shown below, within
> > the while loop a lock is being placed on the database file.
> > How do I fix this problem?
> >
> > Thanks very much!!
> >
> > Public Function RemoveOrientationAMPM(aRs As ADODB.Recordset) As Boolean
> > Dim sOrientation As String
> >
> > ' Check if the Orientation field exists in the recordset
> > If FieldExists("Orientation", aRs) Then
> > With aRs
> > If .RecordCount > 0 Then
> > .MoveFirst ' Move to the first record
> >
> > ' While there are still records
> > Do While Not .EOF
> > ' Get the string value from the database
> > sOrientation = .Fields("Orientation").Value
> >
> > ' Remove the AM if it exists
> > sOrientation = Left(sOrientation, IIf(InStr(sOrientation, "A") >
> > 0, InStr(sOrientation, "AM") - 1, Len(sOrientation)))
> >
> > ' Remove the PM if it exists
> > sOrientation = Left(sOrientation, IIf(InStr(sOrientation, "P") >
> > 0, InStr(sOrientation, "PM") - 1, Len(sOrientation)))
> >
> > ' Write the modified value back into the field
> > .Fields("Orientation").Value = Trim(sOrientation)
> >
> > ' Get the next record
> > .MoveNext
> > Loop
> > End If
> > End With
> > End If
> >
> > RemoveOrientationAMPM = True
> >
> > Exit Function
> >
> > ErrorHandler:
> > MsgBox Err.Number & " " & Err.Description
> > RemoveOrientationAMPM = False
> > End Function
>
>
>



Relevant Pages

  • Re: MaxLocksPerFile problem
    ... I have the same problem but I am already opening and closing the table ... I have 4GB memory and increasing the MaxLocksPerFile to ... closing the recordset and re-opening it. ... >>that gets altered generates a file lock and each file lock takes up 2 bytes. ...
    (microsoft.public.access.modulesdaovba)
  • RE: Newbie ADODB.Recordset MoveNext problem
    ... This function doesn't touch the database. ... How was the recordset setup? ... > system registry an error occurs. ... > RemoveOrientationAMPM = False ...
    (microsoft.public.data.ado)