Hello,
I have an mdb file that acts like a focal point, which links 7 mdb files, including 6 input files, and 1 output file. The focal mdb file has this code that pulls one row at a time from each of the 6 input files, and feeds the data into an excel model. The excel model then creates one row of output which is moved to the mdb output file by the code.
I have about 1 million records, the code works well before it stops at random with the following error message:
Run-time error ‘-2147217911(80040e09)’:
Cannot update. Database or object is read-only.
Does anyone know what is causing this? I’m new to VBA and this is a legacy problem.
Your help is greatly appreciated!
********************************************************
I have an mdb file that acts like a focal point, which links 7 mdb files, including 6 input files, and 1 output file. The focal mdb file has this code that pulls one row at a time from each of the 6 input files, and feeds the data into an excel model. The excel model then creates one row of output which is moved to the mdb output file by the code.
I have about 1 million records, the code works well before it stops at random with the following error message:
Run-time error ‘-2147217911(80040e09)’:
Cannot update. Database or object is read-only.
Does anyone know what is causing this? I’m new to VBA and this is a legacy problem.
Your help is greatly appreciated!
********************************************************
Code:
[COLOR=black][FONT=Verdana]Set rstUpdate = New ADODB.Recordset[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]With rstUpdate[/FONT][/COLOR]
[COLOR=black][FONT=Verdana] Set .ActiveConnection = CurrentProject.Connection[/FONT][/COLOR]
[COLOR=black][FONT=Verdana] .CursorType = adOpenKeyset[/FONT][/COLOR]
[COLOR=black][FONT=Verdana] .LockType = adLockOptimistic[/FONT][/COLOR]
[COLOR=black][FONT=Verdana] .Open "tbl_Supercalc_Output", Options:=admCmdTableDirect[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]End With[/FONT][/COLOR]
[COLOR=black][FONT=Verdana] [/FONT][/COLOR]
[COLOR=black][FONT=Verdana] EndTime = Now()[/FONT][/COLOR]
[COLOR=black][FONT=Verdana] With rstUpdate[/FONT][/COLOR]
[COLOR=black][FONT=Verdana] .AddNew[/FONT][/COLOR]
[COLOR=black][FONT=Verdana] .Fields("Loan_sid") = objActiveWksh.Cells(7, 67).Value[/FONT][/COLOR]
[COLOR=black][FONT=Verdana] .Fields("Interval") = EndTime[/FONT][/COLOR]
[COLOR=black][FONT=Verdana] .Fields("Effective_Yield") = objActiveWksh.Cells(7, 68).Value[/FONT][/COLOR]
[COLOR=black][FONT=Verdana] .Fields("All_in_Funding_Cost") = objActiveWksh.Cells(7, 69).Value[/FONT][/COLOR]
[COLOR=black][FONT=Verdana] .Fields("Gross_Spread") = objActiveWksh.Cells(7, 70).Value[/FONT][/COLOR]
[COLOR=black][FONT=Verdana] .Fields("Cost_to_Originate") = objActiveWksh.Cells(7, 71).Value[/FONT][/COLOR]
[COLOR=black][FONT=Verdana] .Fields("Cost_to_Service") = objActiveWksh.Cells(7, 72).Value[/FONT][/COLOR]
[COLOR=black][FONT=Verdana] …[/FONT][/COLOR]
[COLOR=black][FONT=Verdana] .Update[/FONT][/COLOR]
[COLOR=black][FONT=Verdana] End With[/FONT][/COLOR]
[COLOR=black][FONT=Verdana] Set rstUpdate = Nothing[/FONT][/COLOR]
[COLOR=black][FONT=Verdana] .MoveNext[/FONT][/COLOR]
[COLOR=black][FONT=Verdana] Loop[/FONT][/COLOR]