dao 3.5/3.6 
Author Message
 dao 3.5/3.6

Hi there,

I have word linking to an Access database via dao. I have added a reference
to the dao 3.5 model in my original template. this all works fine. Now, on
some of our machines, there is no dao 3.5 but a version of 3.6 because
various apps have been installed that must have upgraded the dao version. On
those machines, my db connection fails. I have to manually change the
reference on those machines which is very tedious. Is there a way of cheking
the reference or making this process automatic?

Cheers Christoph



Sat, 05 Jul 2003 20:29:12 GMT  
 dao 3.5/3.6
Hi Christoph,

Built your template with the reference you need on your system. When you're
going to distribute it, delete the reference and add a AutoOpen and AutoNew
macro that sets the reference for you:

----------------------------------------
Sub AutoOpen()

  On Error GoTo ErrHandlerAutoOpen
  'Ref to DAO 3.6
  With Application.VBE.ActiveVBProject.References
    .AddFromGuid "{00025E01-0000-0000-C000-000000000046}", 5, 0
  End With
  Exit Sub

DAO351:
  'Ref to DAO 3.51
  With Application.VBE.ActiveVBProject.References
    .AddFromGuid "{00025E01-0000-0000-C000-000000000046}", 4, 0
  End With
  Exit Sub

ErrHandlerAutoOpen:
  Select Case Err
    Case 48
    'Error in loading DLL
    'Try again with DAO 3.51
      GoTo DAO351
    Case Else
      'ErrHandler if neither DAO 3.51 or DAO 3.6 installed
  End Select

End Sub
----------------------------------------

To find out which numbers you need, just loop through all the references
when the correct DLL is set in Tools - References:

----------------------------------------------------------------------
Dim oReference As Reference

  For Each oReference In VBE.ActiveVBProject.References
    If InStr(1, oReference.Name, "DAO", vbTextCompare) > 0 Then
      Debug.Print oReference.Name
      Debug.Print oReference.GUID
      Debug.Print oReference.Major
      Debug.Print oReference.Minor
    End If
  Next
  Set oReference = Nothing
----------------------------------------------------------------------
You'll need a reference to the Microsoft Visual Basic for Applications
Extensibilty Library to run this last procedure.

Hope this helps,
regards,
Astrid

So that all can benefit from the discussion,
please post all followups to the newsgroup.

Visit the MVP Word FAQ site at http://www.mvps.org/word/
For direct access to all Microsoft newsgroups:



Quote:
> Hi there,

> I have word linking to an Access database via dao. I have added a
reference
> to the dao 3.5 model in my original template. this all works fine. Now, on
> some of our machines, there is no dao 3.5 but a version of 3.6 because
> various apps have been installed that must have upgraded the dao version.
On
> those machines, my db connection fails. I have to manually change the
> reference on those machines which is very tedious. Is there a way of
cheking
> the reference or making this process automatic?

> Cheers Christoph



Mon, 07 Jul 2003 00:42:32 GMT  
 dao 3.5/3.6
Hi Astrid,

Thanks for that, this is great, I did know it was not going to be so easy,
but the stuff with the GUID would not have been too easy to figure out. So,
how can I find out what number it is?

Now, what happens if there is a new version of DAO, i.e. DAO 3.7? Is that
not going to make things even more confusing?

Cheers Christoph


Quote:
> Hi Christoph,

> Built your template with the reference you need on your system. When
you're
> going to distribute it, delete the reference and add a AutoOpen and
AutoNew
> macro that sets the reference for you:

> ----------------------------------------
> Sub AutoOpen()

>   On Error GoTo ErrHandlerAutoOpen
>   'Ref to DAO 3.6
>   With Application.VBE.ActiveVBProject.References
>     .AddFromGuid "{00025E01-0000-0000-C000-000000000046}", 5, 0
>   End With
>   Exit Sub

> DAO351:
>   'Ref to DAO 3.51
>   With Application.VBE.ActiveVBProject.References
>     .AddFromGuid "{00025E01-0000-0000-C000-000000000046}", 4, 0
>   End With
>   Exit Sub

> ErrHandlerAutoOpen:
>   Select Case Err
>     Case 48
>     'Error in loading DLL
>     'Try again with DAO 3.51
>       GoTo DAO351
>     Case Else
>       'ErrHandler if neither DAO 3.51 or DAO 3.6 installed
>   End Select

> End Sub
> ----------------------------------------

> To find out which numbers you need, just loop through all the references
> when the correct DLL is set in Tools - References:

> ----------------------------------------------------------------------
> Dim oReference As Reference

>   For Each oReference In VBE.ActiveVBProject.References
>     If InStr(1, oReference.Name, "DAO", vbTextCompare) > 0 Then
>       Debug.Print oReference.Name
>       Debug.Print oReference.GUID
>       Debug.Print oReference.Major
>       Debug.Print oReference.Minor
>     End If
>   Next
>   Set oReference = Nothing
> ----------------------------------------------------------------------
> You'll need a reference to the Microsoft Visual Basic for Applications
> Extensibilty Library to run this last procedure.

> Hope this helps,
> regards,
> Astrid

> So that all can benefit from the discussion,
> please post all followups to the newsgroup.

> Visit the MVP Word FAQ site at http://www.mvps.org/word/
> For direct access to all Microsoft newsgroups:



> > Hi there,

> > I have word linking to an Access database via dao. I have added a
> reference
> > to the dao 3.5 model in my original template. this all works fine. Now,
on
> > some of our machines, there is no dao 3.5 but a version of 3.6 because
> > various apps have been installed that must have upgraded the dao
version.
> On
> > those machines, my db connection fails. I have to manually change the
> > reference on those machines which is very tedious. Is there a way of
> cheking
> > the reference or making this process automatic?

> > Cheers Christoph



Mon, 07 Jul 2003 01:37:53 GMT  
 dao 3.5/3.6
Hi Christoph,

Quote:
> Thanks for that, this is great, I did know it was not going to be so easy,
> but the stuff with the GUID would not have been too easy to figure out.
So,
> how can I find out what number it is?

You mean the arguments for the AddFromGuid method? You can get these
properties: Guid, Major and Minor by running the last procedure in my
previous post when you've set the reference.

Quote:
> Now, what happens if there is a new version of DAO, i.e. DAO 3.7? Is that
> not going to make things even more confusing?

Yep .. then you have to modify it. But apart from setting the references
manually there's no other way to do it I'm afraid.

Hope this helps,
regards,
Astrid

So that all can benefit from the discussion,
please post all followups to the newsgroup.

Visit the MVP Word FAQ site at http://www.mvps.org/word/
For direct access to all Microsoft newsgroups:

Quote:



> > Hi Christoph,

> > Built your template with the reference you need on your system. When
> you're
> > going to distribute it, delete the reference and add a AutoOpen and
> AutoNew
> > macro that sets the reference for you:

> > ----------------------------------------
> > Sub AutoOpen()

> >   On Error GoTo ErrHandlerAutoOpen
> >   'Ref to DAO 3.6
> >   With Application.VBE.ActiveVBProject.References
> >     .AddFromGuid "{00025E01-0000-0000-C000-000000000046}", 5, 0
> >   End With
> >   Exit Sub

> > DAO351:
> >   'Ref to DAO 3.51
> >   With Application.VBE.ActiveVBProject.References
> >     .AddFromGuid "{00025E01-0000-0000-C000-000000000046}", 4, 0
> >   End With
> >   Exit Sub

> > ErrHandlerAutoOpen:
> >   Select Case Err
> >     Case 48
> >     'Error in loading DLL
> >     'Try again with DAO 3.51
> >       GoTo DAO351
> >     Case Else
> >       'ErrHandler if neither DAO 3.51 or DAO 3.6 installed
> >   End Select

> > End Sub
> > ----------------------------------------

> > To find out which numbers you need, just loop through all the references
> > when the correct DLL is set in Tools - References:

> > ----------------------------------------------------------------------
> > Dim oReference As Reference

> >   For Each oReference In VBE.ActiveVBProject.References
> >     If InStr(1, oReference.Name, "DAO", vbTextCompare) > 0 Then
> >       Debug.Print oReference.Name
> >       Debug.Print oReference.GUID
> >       Debug.Print oReference.Major
> >       Debug.Print oReference.Minor
> >     End If
> >   Next
> >   Set oReference = Nothing
> > ----------------------------------------------------------------------
> > You'll need a reference to the Microsoft Visual Basic for Applications
> > Extensibilty Library to run this last procedure.

> > Hope this helps,
> > regards,
> > Astrid

> > So that all can benefit from the discussion,
> > please post all followups to the newsgroup.

> > Visit the MVP Word FAQ site at http://www.mvps.org/word/
> > For direct access to all Microsoft newsgroups:



> > > Hi there,

> > > I have word linking to an Access database via dao. I have added a
> > reference
> > > to the dao 3.5 model in my original template. this all works fine.
Now,
> on
> > > some of our machines, there is no dao 3.5 but a version of 3.6 because
> > > various apps have been installed that must have upgraded the dao
> version.
> > On
> > > those machines, my db connection fails. I have to manually change the
> > > reference on those machines which is very tedious. Is there a way of
> > cheking
> > > the reference or making this process automatic?

> > > Cheers Christoph



Mon, 07 Jul 2003 06:06:58 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. dao 3.5/3.6

2. PB : DAO 3.5 / 3.6

3. Moving from DAO 3.5 to DAO 3.6

4. Convert DAO 3.5 to DAO 3.6 Jet Engine 4.0

5. DAO 3.6 vs DAO 3.5 (VB6.0 sp3)

6. Upgrade from DAO 3.5 to DAO 3.6

7. DAO 3.6 and DAO 3.5

8. DAO 3.6 changes from 3.5

9. DAO 3.5 from 3.6

10. Reference DAO 3.6 Object Library or DAO 2.5/3.51 Compatibility Library

11. upgrade from DAO 3.51 to DAO 3.6??

12. DAO 3.51 to DAO 3.6 NULLs question

 

 
Powered by phpBB® Forum Software