|
Subject:
|
VBA to create relationships in Access
|
|
Posted By:
|
sunny76
|
Post Date:
|
6/30/2005 9:52:41 PM
|
Hi,
Does anybody know how to write a VBA to create relationship in Access? I have a table imported from Excel and this table is linked to other tables in Access to create various queries. The data in the Excel changes everyday so importing it into Access is necessary. Does anybody know how to solve this problem?
Thanks
|
|
Reply By:
|
mmcdonal
|
Reply Date:
|
7/1/2005 6:50:35 AM
|
When you create the queries, just create the relationships in the query design window. This will work the same as establishing a relationship between tables.
I have solutions that import four tables, two from Excel, and two from Access. No relationships are created. Then I create them in the query design window, and they are persistent in the query, which is really the only place you need them.
I also have a solution that is linked to both Access and SQL tables. I use the query design window to establish the relationships I need, although I could do this in the Relationship window since they are persistent tables. But then I don't have the luxury of deleting the tables when I want without error messages.
HTH
mmcdonal
|
|
Reply By:
|
sunny76
|
Reply Date:
|
7/4/2005 1:05:23 AM
|
Hi,
Yes, seems like the relationships need only to be established once. But now, I have a problem creating a macro to delete the table. The macro action I'm using is "DeleteObject" but I get an error everytime.
|