Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Deleting Records in Data Sheet(Slow) vs Macro(Fast)

Status
Not open for further replies.

KMITCH

MIS
May 1, 2000
42
US
Often times I need to refresh(empty) 1 or more tables
prior to running a process.

I've noticed that, when I use a Delete in a Macro or
Module to do this, the records are deleted instantaneously,
even for relatively large numbers of records.

Selecting all records and deleting via the datasheet is
very slow by comparison.

Just to satisfy my curiosity, I'm interested to know why
the datasheet delete is so much slower.

Thanks,
Keith [sig][/sig]
 
Probably because your PC has to refresh the screen and so forth. When you do it in VBA code it just marks the record as deleted and they are not deleted until the next time you Compact.

So it has to do with runing more code inside of Access itself to show you want it's doing. In VBA code none of this occurs. No screen interaction.
You can do a test sometime
Make a loop 'For' or 'DO' and have it Debug.print something
Then run the loop again an REM out the debug print and you should notice it is faster when it does not have to print to the screen. [sig]<p>DougP, MCP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br> Ask me how Bar-codes can help you be more productive.[/sig]
 
Thanks Doug. I'll take that answer.

Keith [sig][/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top