Re: Scan with Object or DAO.Recordset
- From: "Allen Browne" <AllenBrowne@xxxxxxxxxxxxxx>
- Date: Wed, 26 Dec 2007 09:45:42 +0900
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.
<johnie@xxxxxxxxxx> wrote in message news:fkrsq0$288l$1@xxxxxxxxxxxxxxxxxxxxxx
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
.
- Follow-Ups:
- Re: Scan with Object or DAO.Recordset
- From: johnie
- Re: Scan with Object or DAO.Recordset
- References:
- Scan with Object or DAO.Recordset
- From: johnie
- Scan with Object or DAO.Recordset
- Prev by Date: Automate compact and repair
- Next by Date: Re: Scan with Object or DAO.Recordset
- Previous by thread: Scan with Object or DAO.Recordset
- Next by thread: Re: Scan with Object or DAO.Recordset
- Index(es):
Relevant Pages
|