Results 1 to 7 of 7
  1. #1
    Join Date
    Oct 2003
    Location
    Chicago, IL
    Posts
    154

    Unanswered: I'm sure this is simple - Can't use DAO?!

    Hey people,

    I see this all over the place:

    Dim db As DAO.Database
    Dim rs As DAO.Recordset

    I understand that I can use ADO as an alternative but I am not certain what the equivalent items to the above would be. Beuller?

    thx

  2. #2
    Join Date
    Oct 2003
    Location
    Chicago, IL
    Posts
    154

    Ah, nevermind...

    I see that this only means that I'm going to have to actually start using my brains again... agggh.

    Time for me to study up, kids

  3. #3
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926

    Ado

    Dim rs as ADODB.RecordSet
    Set rs = new ADODB.RecordSet

    To open it:
    Dim strSQL as string
    strSQL = "Select * from MyTable"

    '* To open in a writeable status
    rs.open strSQL, currentproject.connection, adopendynamic, adlockoptimistic
    '* recordcount cannot be used

    '* To open as a keyset and read only
    rs.open strSQL, currentproject.connection, adopenkeyset, adlockreadonly
    '* recordcount can be used
    Dim RC as integer
    RC = rs.recordcount

    '* To open as a forward only and read only
    rs.open strSQL, currentproject.connection, adopenForwardOnly, adlockreadonly

    '* To open as static only and read only
    rs.open strSQL, currentproject.connection, adopenStatic, adlockreadonly
    '* recordcount can be used
    Dim RC as integer
    RC = rs.recordcount
    ....
    ....
    rs.close
    set rs = nothing

    Personally, I like ADO much better but others will have different opinons.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  4. #4
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    What is your actual question? Are you unable to use DAO or do you want to convert to ADO?
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  5. #5
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926

    DAO verses ADO

    For those that won't convert to ADO, I'm wondering why you prefer DAO to ADO. ADO I think is much easier to work with. I also believe that MSAccess XP defaults to ADO where the previous versions defaulted to DAO.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  6. #6
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    Quote Originally Posted by pkstormy
    For those that won't convert to ADO, I'm wondering why you prefer DAO to ADO. ADO I think is much easier to work with. I also believe that MSAccess XP defaults to ADO where the previous versions defaulted to DAO.

    JasonM from AccessVBA says it better than I do.

    If I had my druthers, we would be using ADO.NET from access, but that's a lofty stretch to hope for anytime soon.
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  7. #7
    Join Date
    Oct 2003
    Location
    Chicago, IL
    Posts
    154
    Thanks for that, people... I realized an alternate workaround to the problem, however to answer the question:

    Quote Originally Posted by Teddy
    What is your actual question? Are you unable to use DAO or do you want to convert to ADO?
    I was unable to use DAO. I discovered that I could enable the plugin to get it working, however I was building an app for a large organization that doesn't enable it by default and wanted to avoid incompatibilities in my app. ( In case I was kidnapped by albino pygmies and wasn't available to help them resolve it on a new version of access that was installed, etc.)

    I think I wanted to use this chunk for a dynamic reporting object but I ended up addressing it using a combination of strings associated with combo boxes, list boxes and such. Lots of code but it worked.

    Thanks for the explanation, I am sure I will reference it in the near future!

    Best,

    Mitch

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •