Quering two tables in two different files 
Author Message
 Quering two tables in two different files

I have data in two tables, and both tables are in different Access97
files.  It is easy to get data from two tables in the same file, but how
do I get data from tables in different files?  For example:

        c:\Data\Inventory.mdb
        RawInventory            'Raw material inventory table
          PartNum               'Fields
          PartName
          Description
          Qty

        c:\Data\Supplier.mdb
        Supplier                'Supplier table
          PartNum               'Fields
          Name
          Address

To make the example easy, I want a record set with RawInventory.PartNum,
Supplier.Name, RawInventory.Name, RawInventory.Description.  How do I
specify the location of Supplier?

Ironically, many of the VB texts talk about table normalization, but
none (seen so far) describe how to get data from tables in different
files.  Anyone interested in writing a book?

Thanks in advance.
Dennis,



Mon, 29 Dec 2003 05:23:36 GMT  
 Quering two tables in two different files

Quote:
> I have data in two tables, and both tables are in different Access97
> files.  It is easy to get data from two tables in the same file, but how
> do I get data from tables in different files?  For example:

Two different ways off the top of my head:

1) Create a linked table in DB A that points to the table in DB B. Then you
can write code as if both tables existed in DB A.

2) Use the IN clause of Jet SQL. I don't typically use ADO against Access
databases, so I'm not sure if it supports it, but DAO definitely does.

Set db = OpenDatabase("c:\Data\Inventory.mdb")
Set rs = db.OpenRecordset("select * from RawInventory, Supplier in
""c:\Data\Supplier.mdb"" where RawInventory.PartNum = Supplier.PartNum")



Mon, 29 Dec 2003 05:56:02 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Trying to bind data from two different tables to two different controls

2. Open Two Database with Two System.Mda and Two different User Names and Password

3. select box should show values from two different fields from different tables

4. Table join between two tables in different databases

5. Pressing a key produce two events in two different forms

6. Two tables, two databases

7. Linking two Access tables in two databases

8. Linking two tables from two diferent databases.

9. combine two columns from two tables?

10. Joining two tables from two databases

11. Here's a sticky wicket - joining two tables on two diffrent servers with ADO

12. Two Identical Tables Open with totally different timing

 

 
Powered by phpBB® Forum Software