Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 30th, 2005, 09:52 PM
Authorized User
 
Join Date: Jun 2005
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Default VBA to create relationships in Access

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

 
Old July 1st, 2005, 06:50 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

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
 
Old July 4th, 2005, 01:05 AM
Authorized User
 
Join Date: Jun 2005
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.








Similar Threads
Thread Thread Starter Forum Replies Last Post
Create a .DLL callable from VBA Dan412 VB How-To 1 August 20th, 2007 10:32 AM
Create rectangle on a form with Vba Coby Access VBA 2 June 25th, 2007 04:11 PM
Code works in Excel VBA but not Access VBA fossx Access VBA 2 May 21st, 2007 08:00 AM
VBA to create PDF from webpage ncarty97 Excel VBA 0 September 25th, 2006 02:48 PM
Create/Add controls to Access Form: VBA program AccessBeginner Access VBA 1 October 13th, 2005 06:48 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.