J
jeff
gday all
Scenario:
Access v11 SP2 (Office 2003)
2 Access tables in application database (not linked)
Table1 has approx 450,000 records and Table2 has approx 310,000 records
2 subs each the same but processing the 2 tables.
The first one works AOK, the second returns the error:
Error# 3052 was generated by DAO.Recordset
File sharing lock count exceeded. Increase MaxLocksPerFile registry
entry.
Code snippets:
- This one works perfectly all the way through the 450,000 records.
Public Sub subWireSequencing()
Dim ldbsCurrent As Database
Dim lrstSource As Recordset
Dim strSQL As String, lstrCurrentCable As String
Dim intNewWireSequence As Integer
Set ldbsCurrent = CurrentDb()
strSQL = "SELECT * FROM CableSetWires " & _
"ORDER BY CABLEID, WIRESEQUENCE, SEQUENCE;"
Set lrstSource = ldbsCurrent.OpenRecordset(strSQL, dbOpenDynaset)
lrstSource.MoveFirst
lstrCurrentCable = ""
intNewWireSequence = 0
' process each record
Do While Not lrstSource.EOF
' if start of a new cable record then reset the sequencing
If lstrCurrentCable <> lrstSource.Fields("CABLEID").Value Then
lstrCurrentCable = lrstSource.Fields("CABLEID").Value
intNewWireSequence = 0
End If
' increment the current wire sequence
intNewWireSequence = intNewWireSequence + 1
' update the wire sequence with the new sequence number
lrstSource.Edit
lrstSource.Fields("WIRESEQUENCE").Value = intNewWireSequence
lrstSource.Update
lrstSource.MoveNext
Loop
lrstSource.Close
- This one fails at around ~9500 records
Public Sub subWireSetSequencing()
Dim ldbsCurrent As Database
Dim lrstSource As Recordset
Dim strSQL As String, lstrCurrentCable As String
Dim intNewSetSequence As Integer
Set ldbsCurrent = CurrentDb()
strSQL = "SELECT * FROM CableSets " & _
"ORDER BY CABLEID, SEQUENCE, SETSEQUENCE;"
Set lrstSource = ldbsCurrent.OpenRecordset(strSQL, dbOpenDynaset)
lrstSource.MoveFirst
lstrCurrentCable = ""
intNewSetSequence = 0
' process each record
Do While Not lrstSource.EOF
' if start of a new cable record then reset the sequencing
If lstrCurrentCable <> lrstSource.Fields("CABLEID").Value Then
lstrCurrentCable = lrstSource.Fields("CABLEID").Value
intNewSetSequence = 0
End If
' increment the current Set sequence
intNewSetSequence = intNewSetSequence + 1
' update the Set sequence with the new sequence number
lrstSource.Edit
lrstSource.Fields("SETSEQUENCE").Value = intNewSetSequence
lrstSource.Update
lrstSource.MoveNext
Loop
lrstSource.Close
As can be seen....almost identical code...different tables...it has got be
munted! Can anyone help????
cheers
Jeff
Scenario:
Access v11 SP2 (Office 2003)
2 Access tables in application database (not linked)
Table1 has approx 450,000 records and Table2 has approx 310,000 records
2 subs each the same but processing the 2 tables.
The first one works AOK, the second returns the error:
Error# 3052 was generated by DAO.Recordset
File sharing lock count exceeded. Increase MaxLocksPerFile registry
entry.
Code snippets:
- This one works perfectly all the way through the 450,000 records.
Public Sub subWireSequencing()
Dim ldbsCurrent As Database
Dim lrstSource As Recordset
Dim strSQL As String, lstrCurrentCable As String
Dim intNewWireSequence As Integer
Set ldbsCurrent = CurrentDb()
strSQL = "SELECT * FROM CableSetWires " & _
"ORDER BY CABLEID, WIRESEQUENCE, SEQUENCE;"
Set lrstSource = ldbsCurrent.OpenRecordset(strSQL, dbOpenDynaset)
lrstSource.MoveFirst
lstrCurrentCable = ""
intNewWireSequence = 0
' process each record
Do While Not lrstSource.EOF
' if start of a new cable record then reset the sequencing
If lstrCurrentCable <> lrstSource.Fields("CABLEID").Value Then
lstrCurrentCable = lrstSource.Fields("CABLEID").Value
intNewWireSequence = 0
End If
' increment the current wire sequence
intNewWireSequence = intNewWireSequence + 1
' update the wire sequence with the new sequence number
lrstSource.Edit
lrstSource.Fields("WIRESEQUENCE").Value = intNewWireSequence
lrstSource.Update
lrstSource.MoveNext
Loop
lrstSource.Close
- This one fails at around ~9500 records
Public Sub subWireSetSequencing()
Dim ldbsCurrent As Database
Dim lrstSource As Recordset
Dim strSQL As String, lstrCurrentCable As String
Dim intNewSetSequence As Integer
Set ldbsCurrent = CurrentDb()
strSQL = "SELECT * FROM CableSets " & _
"ORDER BY CABLEID, SEQUENCE, SETSEQUENCE;"
Set lrstSource = ldbsCurrent.OpenRecordset(strSQL, dbOpenDynaset)
lrstSource.MoveFirst
lstrCurrentCable = ""
intNewSetSequence = 0
' process each record
Do While Not lrstSource.EOF
' if start of a new cable record then reset the sequencing
If lstrCurrentCable <> lrstSource.Fields("CABLEID").Value Then
lstrCurrentCable = lrstSource.Fields("CABLEID").Value
intNewSetSequence = 0
End If
' increment the current Set sequence
intNewSetSequence = intNewSetSequence + 1
' update the Set sequence with the new sequence number
lrstSource.Edit
lrstSource.Fields("SETSEQUENCE").Value = intNewSetSequence
lrstSource.Update
lrstSource.MoveNext
Loop
lrstSource.Close
As can be seen....almost identical code...different tables...it has got be
munted! Can anyone help????
cheers
Jeff