Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1002
  • Last Modified:

Error with DAO.DBEngine.36

URGENT!!  Here is my code in MS Access 2002 SP3 (Win XP Pro SP2 platform):

-------
Function ViewLink()

    Dim oDAO
    Set oDAO = CreateObject("DAO.DBEngine.36")
   
    Dim db As DAO.database
    Dim tbl As TableDef
   
    Set db = CurrentDb
    On Error Resume Next
    For Each tbl In db.TableDefs
        Debug.Print tbl.Connect
    Next tbl


End Function
-------

I am trying to set reference to DAO 3.6 via code in order for the rest of my module to work, but I get a "Compile Error / User-defined type not defined".  I know I'm missing something simple here, but I can't quite put my finger on it.  Help!

Thanks,
Mike
0
CCIG2006
Asked:
CCIG2006
2 Solutions
 
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
What's the purpose of the oDAO Dim/Set?  Remove them, and try running your code again.
0
 
GrahamSkanRetiredCommented:
I think that you will either have to set the reference to DAO in the IDE or use late binding.
0
 
JRCSystemsCommented:
Here are your choices:

1. Either manually make a reference to DAO 3.6 in VB's PROJECT/REFERENCES,
    find and check [x] Microsoft DAO 3.6 Object Library.

or

2. Change the Type Name of all of your specific DAO object variables to "Object"
    If you don't have a reference to DAO in your VB project, you can't use early binding.

3. Unsure looking at your code snippet what "CurrentDB" is.
    Make sure its properly defined.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now