Code for including a Reference: DAO 3.6

  • Hi,

    I need code to programmatically include Microsoft DAO 3.6 Object Library at run-time rather than having the user do it in VBE by clicking Tools > Reference.

    Any help will be highly appreciated.


  • Re: Code for including a Reference: DAO 3.6

    Hi m

    What you are wanting to do is use a method called "late binding". To a lot of programmers, this is "yukky". The following is a good link to give you a bit of a background

    Its not so much that you can't late bind DAO, more that its better if you don't. You are using Access 2K so its principal reference will be to ADO, but if you are wanting to use DAO code/methods, then you will need to prefix everything as in the kb article posted by Tanis.

    When I need to do use DAO, I reference it in the manner that you don't wish to use, then move it above the ADO reference. This gives it priority.

    Why am I telling you this - well simply because I have a suggestion that may allow you to resolve your problem without the need for late binding.

    Create a blank MDB with the DAO reference already set and given the appropriate priority. Ensure that any other references are included. Save this to a network drive; when anyone needs to open a fresh MDB, they grab a copy of this one instead of creating their own fresh one.

    If this is not suitable, or you still have questions, just add another post to the thread.



  • Re: Code for including a Reference: DAO 3.6

    Hi Guys!

    Thanks for the replies.

    I checked out the kb link, and I guess you're right about not being able to call the DAO reference programmatically.

    Thanks for your suggestion. I'll give it a try.



Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!