By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,493 Members | 1,208 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,493 IT Pros & Developers. It's quick & easy.

Scan with Object or DAO.Recordset

P: n/a
To scan through a table and edit values I can use OpenRecordset with:
1. Dim rst As Object etc., or
2. Dim rst As DAO.Recordset etc.
Is there a performance difference between the two or are there reasons why I
should be using one in stead of the other?

Thanks,
John
Dec 25 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
The rule of thumb is to use the most specific data type you can.
Recordset is much more specific than Object.
(Variant is even broader yet.)

The only reason the Wizard usings Object is because Microsoft tried to
introduce ADO recordsets into Access 2000, where previous versions had use
DAO recordsets. So Object was the narrowest type they could use (since the
Recordset object from the ADO library and the DAO library require
disambiguating.) But when you write code, you know the library you are
using, so:
Dim rst AS DAO.Recordset
is much better code.

One reason it's better is that Access is able to verify your code uses the
correct methods and properties of that specific type. Using Object it can't
verify the compilation. It can't offer all the right things in the
Intellisense lists as you type the code either.

In summary, use the most specfic data type you can, and the narrowest scope
you can.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

<jo****@johnie.comwrote in message
news:fk***********@textnews.wanadoo.nl...
To scan through a table and edit values I can use OpenRecordset with:
1. Dim rst As Object etc., or
2. Dim rst As DAO.Recordset etc.
Is there a performance difference between the two or are there reasons why
I should be using one in stead of the other?

Thanks,
John
Dec 26 '07 #2

P: n/a
Thanks Allen.
John

"Allen Browne" <Al*********@SeeSig.Invalidschreef in bericht
news:47**********************@per-qv1-newsreader-01.iinet.net.au...
The rule of thumb is to use the most specific data type you can.
Recordset is much more specific than Object.
(Variant is even broader yet.)

The only reason the Wizard usings Object is because Microsoft tried to
introduce ADO recordsets into Access 2000, where previous versions had use
DAO recordsets. So Object was the narrowest type they could use (since the
Recordset object from the ADO library and the DAO library require
disambiguating.) But when you write code, you know the library you are
using, so:
Dim rst AS DAO.Recordset
is much better code.

One reason it's better is that Access is able to verify your code uses the
correct methods and properties of that specific type. Using Object it
can't verify the compilation. It can't offer all the right things in the
Intellisense lists as you type the code either.

In summary, use the most specfic data type you can, and the narrowest
scope you can.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

Dec 26 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.