Newbie ADODB.Recordset MoveNext problem
From: f3773t (f3773t_at_discussions.microsoft.com)
Date: 03/17/05
- Next message: Jonathan Bailey: "Re: ADO dates and '0001-01-01'"
- Previous message: scottrm: "monitoring database"
- Next in thread: Chaim: "RE: Newbie ADODB.Recordset MoveNext problem"
- Reply: Chaim: "RE: Newbie ADODB.Recordset MoveNext problem"
- Reply: Val Mazur \(MVP\): "Re: Newbie ADODB.Recordset MoveNext problem"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 17 Mar 2005 00:57:05 -0800
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
- Next message: Jonathan Bailey: "Re: ADO dates and '0001-01-01'"
- Previous message: scottrm: "monitoring database"
- Next in thread: Chaim: "RE: Newbie ADODB.Recordset MoveNext problem"
- Reply: Chaim: "RE: Newbie ADODB.Recordset MoveNext problem"
- Reply: Val Mazur \(MVP\): "Re: Newbie ADODB.Recordset MoveNext problem"
- Messages sorted by: [ date ] [ thread ]