1

I have an Access2003 database which has a table linked in from a SQL Server database. I have this Access vba that updates a column in that SQL Server table. Each month that table gets cleared and a new set of records is imported, the amount of records ranges from 300,000 to 450,000 each monthly.

This Access vba code runs but takes 5+ hours. I need to do something about that, anyone have any ideas of how to speed this up? One idea I had was to convert this to a stored procedure on the SQL Server but I have no idea how to write that so any help is appreciated.

Thanks

bobh.

VBA code:

' update the ID field in the import table 
Dim intCounter As Double 
Set MyRec = MyDB.OpenRecordset("tblMarsImport", dbOpenDynaset, dbSeeChanges) 

MyRec.MoveFirst 
intCounter = Format(Date, "yyyymmdd") & "000001" 

Do While Not MyRec.EOF 
   MyRec.Edit 
   MyRec!MarsID = CStr(intCounter) 
   MyRec.Update 
   MyRec.MoveNext 
   intCounter = intCounter + 1 
Loop 

MyRec.Close 
4

2 に答える 2