Importing Ms Access Table with its relationship at runtime through code

Posted on 2005-05-03
Last Modified: 2013-12-25
Thanks for replying,
At the outset I don't want to create new relationship / field.

Since The relationships are already defined in Database1, I just want to import the Tables along with the relationships from Database1 to Database2.

As mentioned before, i am able to import the table to Database2 but not its relationship.

Further, when I tried to execute the following code, it gave me the error as stated below.
    Set f = rel.CreateField("DeptID", dbInteger)     [error : Type mismatch]
    f.ForeignName = "DeptID"                              [method or data member not found]

I am using the following Reference in my project :
a) Microsoft ActiveXData Object 2.5 Library
b) Micorsof DAO 3.6 Object Library
c) Microsoft Access 9.0 Object Library  

Question by:s_monani
    1 Comment
    LVL 12

    Accepted Solution


    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
    I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
    Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
    This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now