Jim Dettman
jimdettman at earthlink.net
Sat Aug 30 07:45:19 CDT 2003
John, As had been said, the .Execute method would be faster, and a saved querydef better yet. But for 500 records, I doubt you'd notice much difference. The other thing is that unless there is a specific reason for having lngRecordID down the road, then I'd just reference rstTemp!MailListID directly in the SQL statement. Jim Dettman President, Online Computer Services of WNY, Inc. (315) 699-3443 jimdettman at earthlink.net -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com]On Behalf Of John Bartow Sent: Friday, August 29, 2003 6:41 PM To: AccessD Subject: [AccessD] Speed enhancement An easy question for you speed optimizing gurus out there: What should I replace this code (which was meant for a few record updates) with to make it run faster (it now needs to be used for 500+ records). Watch for line wrap. Set rstTemp = db.OpenRecordset("TempMailList") Do Until rstTemp.EOF lngRecordID = rstTemp!MailListID DoCmd.RunSQL "UPDATE MailList SET MailList.StaffID = " & lngNewStaff & ", MailList.DeptTypeID = " & lngNewDept & " WHERE (((MailList.MailListID)=" & lngRecordID & "));" lngCount = lngCount + 1 rstTemp.MoveNext Loop TIA John B. _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com