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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

WHY IS MY RS.ADDNEW SO SLOW? 1

Status
Not open for further replies.

neemi

Programmer
May 14, 2002
519
GB
I have a large piece of code which is really slow and have been trying to determine which part of the code is not efficient.

To do this I placed loads of debug prints everywhere and found out that the rs.addnew piece of code takes about 9 seconds alone.

The table is a very large table but surely there must be a way of speeding this up?

Code:
Set rs = CurrentDb.OpenRecordset("Client_Letters", dbOpenDynaset)
    Debug.Print Now() & " rs start"
    letrs.AddNew
    Debug.Print Now() & " rs end"

Any suggestions very much appreciated.

Has anyone else had a similar sort of problem where rs take so long?

Cheers in advance.
Neemi
 
You may try this:
Set rs = CurrentDb.OpenRecordset("SELECT * FROM Client_Letters WHERE 1=0", dbOpenDynaset)

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Good trick!!

so obviously it opens the rs without any returned records... hence speeding the process up.?

Thats a great tip I have just cut the processing time by 7 secs!!


 
I am so impressed with that last tip!!

do you have any tips like that for recordcounts?

As I have a piece of code where the .recordcount takes a while to run.

 
has anyone had a problem with slow .recordcounts?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top