Results 1 to 2 of 2
  1. #1
    karambos is offline Novice
    Windows 7 64bit Access 2003
    Join Date
    Dec 2013
    Posts
    4

    recreate relationship in a macro

    I have 3 text files which I import into Access: Day1, Day2 and Day3. Each file is a fixed width file and has only one column with no column title. During the import for each table, I give the column a name - SerialNumber. So I have 3 tables in Access, each with one column of type Long Interger, field width = 7. All entries in a table are unique i.e. no duplicates.



    Next, I write a query to give me all those numbers that appear in all three tables:


    Click image for larger version. 

Name:	Capture.JPG 
Views:	5 
Size:	30.7 KB 
ID:	14654

    I run it and it works.


    I'd like to automate this. I decided to use a macro. My thinking is:
    1. delete all 3 tables (because the UPDATE command in Access seems to append data together and I don't want that)
    2. import all three tables again.
    3. Run the existing query.



    I can get my query to successfully accomplish steps 1 & 2 but the problem is in step 3 - the relationship demonstrated by the graphic above has now gone because the tables were deleted.

    My question - How can I re-create this relationship in a macro?

    Any help appreciated

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,820
    Instead of deleting tables, just delete the records, then import to existing tables.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 12-06-2012, 12:29 PM
  2. Replies: 2
    Last Post: 05-05-2012, 02:34 AM
  3. Recreate Word document in Access Report
    By cphelps48 in forum Reports
    Replies: 2
    Last Post: 11-29-2011, 04:32 PM
  4. Replies: 0
    Last Post: 01-12-2011, 12:43 PM
  5. Update / delete and recreate access tables
    By metro17 in forum Access
    Replies: 4
    Last Post: 09-23-2009, 04:45 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums