Results 1 to 7 of 7
  1. #1
    eyal7773 is offline Novice
    Windows Vista Access 2007
    Join Date
    Sep 2010
    Posts
    1

    What is the difference between 2 ways to create a RECORDSET ?

    Hello,
    I would like to know What is the difference between 2 ways to create a RECORDSET.

    Until 2007 I used to create it like this :


    --------------
    Dim db1 As Database
    Dim rec1 As Recordset
    Set db1 = CurrentDb
    Set rec1 = db1.OpenRecordset(strSQL, dbOpenDynaset
    -----------------

    But when 2007 arrived, I read Sams Elison book and then I started to create it like this:
    ----------------
    Dim cnnX As ADODB.Connection
    Set cnnX = CurrentProject.Connection
    Dim myRecordSet As New ADODB.Recordset
    myRecordSet.ActiveConnection = cnnX
    myRecordSet.Open SQLstatement
    ----------------

    WHAT IS THE DIFFERENCE ? is there one way that is more quick ? More efficient ?
    Thanks.

  2. #2
    NoellaG's Avatar
    NoellaG is offline VIP
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Jun 2010
    Location
    Belgium
    Posts
    1,044
    Hi,

    * first way is the "old" DAO way to address recordsets, I used it since access 2. Haven't took the time for access 2010 , but before that ADO was still the way to address recordset clones of forms.

    * The ADO way is younger and more object orientated. I forgot in which version it was first available, but I guess Access 2000. In those days Microsoft told us in some conferences that in time they would stop supporting DAO, but it still stands I see.
    Myself, as I like to use as much as possible object orientated code (I use a lot of class modules and my alltime favorite programming interface is Omnis studio) I mainly use ADO. I don't know if its faster though. Maybe someone else?

    grNG

  3. #3
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    Quote Originally Posted by NoellaG View Post
    In those days Microsoft told us in some conferences that in time they would stop supporting DAO, but it still stands I see.
    there again, DAO is easier for an independent developer to use, so MS is migrating away from it. I'm not sure, but if they stopped supporting DAO, I would bet that SQL migration numbers would start going up. Again, a swift way to earn cash.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    My understanding is that DAO is better optimized for an Access (JET) back end, ADO for others (SQL Server, Oracle, etc). MS definitely started to move away from DAO with A2k, but we dragged them back.

    DAO isn't going anywhere anytime soon. Likewise the pushes towards ADP and DAP were reversed. I think they have theories about what might work for the market and will start in that direction, but at the end of the day they will respond to market forces.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    Quote Originally Posted by pbaldy View Post
    they will respond to market forces.
    they have the most force Paul. in essence they ARE the force. Skywalker even learned his skills from them! Sad, isn't it?

    And No, we haven't dragged MS back at all. I have to take the other side. Stopping the migration to macros would be a great example of how to accomodate the little guy's job security. But of course they're not interested in that.

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    I posted thoughts on macros in post 6 here:

    https://www.accessforums.net/access/...ries-8112.html

    By enhancing macros, they've added to toolbox, not diminished it. VBA is still there for anybody who wants to use it. Don't worry, the MVP's that meet with MS have your back there. They would scream if MS contemplated dropping VBA, and believe it or not MS does listen. Not saying they will always follow MVP advice, but they do listen, both to us and the market.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    well that's good to know Paul. That is certainly one good thing that has come out of better corporate responsibility. If anything else, increased competition has made Bill Gates consider the quality of his programming department. We all know he can sell...

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Ways of preparing data for graphs
    By ajetrumpet in forum Queries
    Replies: 0
    Last Post: 09-11-2010, 10:26 PM
  2. Replies: 1
    Last Post: 11-13-2009, 03:03 AM
  3. difference between drivers
    By tomc1 in forum Access
    Replies: 0
    Last Post: 08-04-2009, 10:41 AM
  4. Replies: 1
    Last Post: 05-30-2009, 04:00 AM
  5. Create a recordset for a report
    By vjboaz in forum Programming
    Replies: 0
    Last Post: 11-18-2008, 03:28 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums