The easiest way would be to have a linked table in database 1 that points to
the table in database 2, and then simply query database 1.
If you don't want to do this, you can query from one database to a table in
another database using:
SELECT CustomerID
FROM Customers
IN OtherDB.mdb
WHERE CustomerID Like "A*";
I haven't tried, but I would assume you could extend this to:
SELECT Customers.CustomerID, Invoices.InvoiceID
FROM Customers
IN OtherDB.mdb
INNER JOIN Invoices
ON Customers.CustomerID = Invoices.CustomerID
WHERE Customers.CustomerID Like "A*";
--
Doug Steele, Microsoft Access MVP
<a style='text-decoration: underline;' href="http://I.Am/DougSteele" target="_blank">http://I.Am/DougSteele</a>
(No private e-mails, please)
"Alex Kudrasev" <alexk DeleteThis @art-technology.com.au> wrote in message
news:ep7RCoSmDHA.964@TK2MSFTNGP10.phx.gbl...
> Is it possible to select data from two databases (Access)...?
>
>
> I've seen examples where SQL becomes
> "select database..table.field from database..table"
>
> But how could the syntax be used when DAO makes you use the database
> reference when executing the SQL, ie:
>
> dim mydb as database
> sqltxt = "select distinct xtitle from reports order by xtitle"
> Set mytable = mydb.OpenRecordset(sqltxt, dbOpenDynaset)
>
> Can anybody help???
>
> Thanks,
>
> Alex Kudrasev
>
>
><!-- ~MESSAGE_AFTER~ -->
>> Stay informed about: Selecting data from two databases