9 Replies Latest reply: Nov 10, 2014 11:23 AM by Paul Wonford RSS

    Import data from two tables

    Paul Wonford

      Hi guys. I have the following tables in an Access database:

       

      Customer

       

      CustomerID

      Name

      Active?

      123

      Bob smith

      Yes

      444

      John Jones

      Yes

      990

      Ed Johnson

      No

      087

      Paul Crisp

      Yes

       

      Address

       

      CustomerID

      Address

      123

      1 Shakespeare Road, Bedford.

      444

      5 Dudley Street, Bedford

      990

      9 Holly View, Sowerby Bridge

      087

      18 Church Lane, Ravensden

       

      I would like to import only customers who are active. The problem with this is that if I tell the code to import only active from the customer table, it still imports the inactive information (customer 990) from the address table. Can anyone suggest anything?

      My basic code is as follows:


      ODBC CONNECT32 TO [MS Access Database;DBQ=C:\Users\u22471\Desktop\QV\New Microsoft Access Database.accdb];
      SQL Select *

      FROM [Customer];
      ODBC CONNECT32 TO [MS Access Database;DBQ=C:\Users\u22471\Desktop\QV\New Microsoft Access Database.accdb];
      SQL Select *

      FROM [Address];