[AccessD] Which Is Faster - DAO or db.Execute?

Max Wanadoo max.wanadoo at gmail.com
Wed Oct 29 18:30:47 CDT 2008


Ah yes, but what about...

A. 
rst=currentbd(sql statement)
if not rst.eof then
 rst.movefirst
do while not rst.eof
if rst!myfield = 1 then
rst.edit
rst!myfield = 2
rst.update
endif
rts.movenext
loop
endif

B.
Sql = "Update myTable set Myfield = 2 where Myfield = 1
Currentdb.execute(sql)

I think B is going to be a lot faster...am I right?

AND

If myfield doesn't exist then you will never know....

Max
Ps ignore typos.

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Stuart McLachlan
Sent: 29 October 2008 21:08
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Which Is Faster - DAO or db.Execute?

If you are looping and updating multiple records one at a time, this is not
in 
the least surprising - I'd be amazed if any of the others where anywhere 
near as fast. Opening and closing a recordset takes time.
 
On 29 Oct 2008 at 7:40, Rocky Smolin at Beach Access  wrote:

> So it would seem that DAO with the OpenRecordset outside the loop is the
> fastest? 
> 
> 
> Rocky Smolin
> Beach Access Software
> 858-259-4334
> www.e-z-mrp.com
> www.bchacc.com
>  
>  
> 
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Martin Reid
> Sent: Wednesday, October 29, 2008 7:09 AM
> To: Access Developers discussion and problem solving
> Subject: Re: [AccessD] Which Is Faster - DAO or db.Execute?
> 
> Susan
> 
> You might find this useful
> 
>
http://www.tech-archive.net/Archive/Access/microsoft.public.access.modulesda
> ovba/2005-03/1330.html
> 
> Martin
> 
> 
> 
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Susan Harkins
> Sent: 29 October 2008 14:00
> To: Access Developers discussion and problem solving
> Subject: Re: [AccessD] Which Is Faster - DAO or db.Execute?
> 
> >
> >  Both are DAO, but what he is asking is if db.Execute with a SQL 
> > statement is faster then opening up a record set, finding the record, 
> > and then doing an .Edit/.Update.
> 
> ======Yes, I realize they're both DAO, I just thought I'd clarify. My
claim
> is that SQL is faster -- it speaks directly to the engine -- it has to be
> faster.
> 
> SUsan H.
> 
> 
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
> 
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
> 
> -- 
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com


-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list