Select statement with SQL Server (1 Viewer)

Blkblts

Registered User.
Local time
Today, 00:50
Joined
Jan 21, 2000
Messages
61
I have a select statement in a VB Module for Access. The table currently contains 150,000 records. If I only bulk copy in a portion of records the VB module will run until approx. 75,000 records, after that I get a run-time error '3669'. Am I requesting this table correctly? Is there a way I can request in chuncks of 50,000?
Thanks in advance for your help. Here a portion of the code.....

Dim wrkODBC As Workspace
Dim conMACESS As Connection
Dim i As Integer
Dim Record_Count As Integer
Dim FieldName As String
Dim Taken_Set As Recordset
Dim Agram_Set As Recordset

'Open Workspace and create connection to ODBC
Set wrkODBC = CreateWorkspace("NewODBCWorkspace", "sa", "", dbUseODBC)
Set conMACESS = wrkODBC.OpenConnection("MACESS", dbDriverNoPrompt)

'Recordsets
Set Agram_Set = conMACESS.OpenRecordset("SELECT * FROM Agram", DB_OPEN_SNAPSHOT)
Set Taken_Set = conMACESS.OpenRecordset("Actions_Taken", dbOpenDynamic, False, dbOptimistic)

'Top of the Agrams table
Agram_Set.MoveFirst
While Not Agram_Set.EOF 'Loop thru the file
For i = 1 To 8 'Actions Taken loop - make sure all 10 T/F fields
'are in extract otherwise "not in collection" error.
FieldName = "Actions_Taken_" + LTrim$(Str$(i)) 'Loop thru field names

If Agram_Set.Fields(FieldName) = "T" Then 'Button is on, put out a record to Cat_Buttons
Taken_Set.AddNew 'Put out a record to Actions_Taken
Taken_Set("Doc_Id") = Agram_Set("Ag_Doc_Id")
Taken_Set("AgType") = Agram_Set("Ag_Type")
Taken_Set("Actions_Taken_Key") = Agram_Set("Ag_Type") + LTrim$(Str$(i)) 'Actions Taken key
Taken_Set.Update
End If

Next i

Agram_Set.MoveNext 'Next record

Wend
Exit Function
 

Users who are viewing this thread

Back
Top Bottom