It's been a while since I've posted here...but I'm getting frustrated.
I've got a process that dumps a bunch of records for Reps from Access into an Excel file...and in between each Rep does a bunch of formatting (that's the reason for not just dumping the entire recordset).
A section of the code is below, but basically it's cycling through the recordset and pasting each field into the appropriate column before moving on.
The problem is it's literally taking 8 seconds to dump one field into one cell (I've stepped through and watched it), and there are 15 fields to dump per record...and 1,000 plus records. That starts adding up.
I have a completely separate database doing almost exactly the same thing (it's for a different company, so some of the fields are different...but the vba process is the same) and I have no problems...when I step through everything happens instantaneously (as it should).
Anybody seen anything like this? Any tips? Thanks for any help.
Kevin
_____________________________________________________
I've got a process that dumps a bunch of records for Reps from Access into an Excel file...and in between each Rep does a bunch of formatting (that's the reason for not just dumping the entire recordset).
A section of the code is below, but basically it's cycling through the recordset and pasting each field into the appropriate column before moving on.
The problem is it's literally taking 8 seconds to dump one field into one cell (I've stepped through and watched it), and there are 15 fields to dump per record...and 1,000 plus records. That starts adding up.
I have a completely separate database doing almost exactly the same thing (it's for a different company, so some of the fields are different...but the vba process is the same) and I have no problems...when I step through everything happens instantaneously (as it should).
Anybody seen anything like this? Any tips? Thanks for any help.
Kevin
_____________________________________________________
Code:
Set DB = CurrentDb
Set QDF = DB.QueryDefs("5_Export")
QDF.Parameters("EnterOffice") = TheOffice
Set RST = QDF.OpenRecordset
CurrentRow = SectionRow
RepStart = SectionRow
With RST
TheSheet.Cells(CurrentRow, 1) = !CaseID
TheSheet.Cells(CurrentRow, 2) = !Office
TheSheet.Cells(CurrentRow, 3) = !AgentName
TheSheet.Cells(CurrentRow, 4) = !CallDate
TheSheet.Cells(CurrentRow, 5) = !BTN
TheSheet.Cells(CurrentRow, 6) = !OrderType
TheSheet.Cells(CurrentRow, 7) = !BillName
TheSheet.Cells(CurrentRow, 8) = !Main_Package
TheSheet.Cells(CurrentRow, 9) = !SBCLD
TheSheet.Cells(CurrentRow, 10) = !DSL
TheSheet.Cells(CurrentRow, 11) = !DSLPlan
TheSheet.Cells(CurrentRow, 12) = !N_ADL1
TheSheet.Cells(CurrentRow, 13) = !Dish
TheSheet.Cells(CurrentRow, 14) = !Homezone
TheSheet.Cells(CurrentRow, 15) = !RepCommPaidAmt
TheSheet.Cells(CurrentRow, 16) = !CommPlan