Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.
Sub CostLoop() Set g_objConn = New ADODB.Connection g_objConn.Open g_sConnectionString Set rs = New ADODB.Recordset rs.Open "tbl", g_objConn, adOpenDynamic, adLockPessimistic For iCounter1 = 1 to (...) For iCounter2 = 1 to (...) For iCounter3 = 1 to (...) ... For iCounter10 = iRecordCounter = iRecordCounter + 1 If iRecordcounter = 1 Then g_objConn.BeginTrans dOutput1 = (...) dOutput2 = (...) dOutput3 = (...) ... dOutput10 = (...) 'SETUP RECORDSET TO ADD A NEW RECORD rs.AddNew 'ASSIGN FIELDS IN TABLE rs!<columnname in table> = <value> rs!Variable1 = iCounter1 rs!Variable2 = iCounter2 rs!Variable3 = iCounter3 rs!Variable4 = iCounter4 rs!Variable5 = iCounter5 rs!Variable6 = iCounter6 rs!Variable7 = iCounter7 rs!Variable8 = iCounter8 rs!Variable9 = iCounter9 rs!Variable10 = iCounter10 rs!Output1 = dOutput1 rs!Output2 = dOutput2 rs!Output3 = dOutput3 rs!Output4 = dOutput4 rs!Output5 = dOutput5 rs!Output6 = dOutput6 rs!Output7 = dOutput7 rs!Output8 = dOutput8 rs!Output9 = dOutput9 rs!Output10 = dOutput10 'ISSUE THE ADD rs.Update If iRecordCounter = 100 Then g_objConn.CommitTrans iRecordCounter = 0 End If Next iCounter10 ... Next iCounter3 Next iCounter2 Next iCounter1 g_objConn.CommitTrans rs.Close Set rs = Nothing End Sub
Join the community of 500,000 technology professionals and ask your questions.
Connect with top rated Experts
13 Experts available now in Live!