Results 1 to 6 of 6
  1. #1
    Lounger
    Join Date
    Aug 2003
    Posts
    32
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Microsoft DAO 3.6 Object Library (word 97, word 2000)

    I am using DAO to connect to a database. I used WOrd 2000 to create my macros etc( i checked the Microsoft DAO 3.6 Object Library in the References menu item ) . When i tried to use the macros in Word 97, it gave me an error. SO, i tried to compile my macros in Word 97, but I could not. What should i do in order to be able to run the macros in both Word 2000 and Word 97?

    Thanks in advance....

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Microsoft DAO 3.6 Object Library (word 97, word 2000)

    DAO 3.6 is the version for Office 2000/2002. In Office 97, the correct version is 3.5 or 3.51.

    If you open the document/template in Word 97 and set a reference to the 3.5 or 3.51 library, the code should work there, and the reference will probably update itself when the document/template is opened in Word 2000. This only works when going to a higher version.

  3. #3
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Microsoft DAO 3.6 Object Library (word 97, word 2000)

    As an alternative strategy, you could use "late binding" by declaring your various DAO objects as Object and then setting them using stuff like one of the following:

    <pre>Sub TryLateBinding1()
    Dim DBE As Object ' Will bind to DAO.DBEngine at runtime
    On Error Resume Next
    ' Try to create object reference to DAO 3.6
    Set DBE = CreateObject("DAO.DBEngine.36")
    ' If it failed, and it's an ActiveX error, try 3.5
    If Err.Number > 0 Then
    If Err.Number = 429 Then
    Err.Clear
    Set DBE = CreateObject("DAO.DBEngine.35")
    If Err.Number > 0 Then GoTo skipInto
    Else
    skipInto:
    MsgBox "ERROR! " & Err.Number & vbCrLf & Err.Description
    Exit Sub
    End If
    End If
    ' Got back to default error handling
    On Error GoTo 0
    Stop
    Set DBE = Nothing
    End Sub

    Sub TryLateBinding2()
    Dim DBE As Object ' Will bind to DAO.DBEngine at runtime
    Select Case Application.Version
    Case "8.0" '97
    ' Try to create object reference to DAO 3.5
    Set DBE = CreateObject("DAO.DBEngine.35")
    Case "9.0", "10.0" '2000-XP
    ' Try to create object reference to DAO 3.6
    Set DBE = CreateObject("DAO.DBEngine.36")
    Case Else
    MsgBox "Cannot detect Word version"
    End Select
    Stop
    Set DBE = Nothing
    End Sub</pre>

    The first uses an ugly error-fall-back method, the second makes certain assumptions about the version of DAO associated with a version of Word. You might need to mix and match various aspects of these examples if you go down this road.

  4. #4
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    Brussels, Brussel, Belgium
    Posts
    159
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Microsoft DAO 3.6 Object Library (word 97, word 2000)

    also make sure your database is in access 97 format.

  5. #5
    Lounger
    Join Date
    Aug 2003
    Posts
    32
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Microsoft DAO 3.6 Object Library (word 97, word 2000)

    1. If i have a template that uses the Microsoft DAO 3.51 Object library in it, what are the minimum requirements needed for it to run on another PC that has Word 97 or Word 2000? I noticed that the template works correctly on "some" WOrd 2000 Pcs and not all. On the ones it does not work on it gives me runtime error 429 : ActiveX component can't create object. thsi error message occurs at teh command where I am trying to "OpenDatabase".

    2. If i want a template to work on both Word 97 and 2000 and uses DAo objects, is it ok to compile the template In Word 97 and it will work on 2000? Am i doing this the right way?

    Thanks...

    Thanks..

  6. #6
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Microsoft DAO 3.6 Object Library (word 97, word 2000)

    When you have the problem on a Word 2000 PC, open the Tools>References dialog and see if you have MISSING there. This would indicate that you cannot simply rely on VBE to "bump up" the DAO library to the next version and you have to use a strategy like one of my examples above. If you don't have a MISSING, consider the issue pieter raises about the file format.

Posting Permissions

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