Connecting to MS Access from ArcObject (VBA)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • armyofus
    New Member
    • Dec 2009
    • 3

    Connecting to MS Access from ArcObject (VBA)

    I want to access a MS Access database where I can pull information from and display it. The trouble is, I cannot get my code to access it. When I look at my code it just doesn't seem right, too.

    where is what I have for access the database:

    Dim ws As Workspace
    Dim db As Database

    Set ws = DBEngine.Worksp ace(0)
    Set db = ws.OpenDatabase ("c:\Users\Desk top\folder \master_sample_ database\B518fe b2009")

    Please help!
  • vb5prgrmr
    Recognized Expert Contributor
    • Oct 2009
    • 305

    #2
    Hmmm, you are missing part of the path or file name...
    Code:
    Set db = ws.OpenDatabase("c:\Users\Desktop\folder \master_sample_database\B518feb2009[b].mdb[/b]")


    Good Luck

    Comment

    • armyofus
      New Member
      • Dec 2009
      • 3

      #3
      Well now I am getting a Compile error: User-defined type not defined. When I was not before?
      Its throwing the error at Dim db As Database.

      Code:

      Dim ws As Workspace
      Dim db As Database

      Set ws = DBEngine.Worksp ace(0)
      Set db = ws.OpenDatabase ("c:\Users\BC\D esktop\Geog485\ master_sample_d atabase\B518feb 2009.mdb")

      Comment

      • vb5prgrmr
        Recognized Expert Contributor
        • Oct 2009
        • 305

        #4
        Well it seems you don't have a referece to Microsoft DAO x.x Object Library. To add this GoTo Project>Referen ces>Scroll down until you see the DAO library you want to use.

        EDIT: (Okay, that is what you would do from within VB, as for ArcObject????)

        Good Luck

        Comment

        Working...