Importing Ms Access Table with its relationship at runtime through code

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  

Who is Participating?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.