by Paul Morris #2 (1 Submission)
Category: Databases/Data Access/DAO/ADO
Difficulty: Advanced
Date Added: Wed 3rd February 2021
Rating:
(3 Votes)
I needed to query 2 password protected Access databases with a single SQL statement.
The Microsoft web page https://support.microsoft.com/kb/113701 was helpful and gave me hope that it may be possible, but was not too clear.
I use ADO with VB6 whereas the Microsoft example was for VB3 and the old ODBC. The Microsoft example worked almost straightaway for me if the databases had no password protection, it was the password protection that made it more difficult.
Eventually after quite a bit of experimentation I cracked it and I thought I must share this with fellow coders in case they have the same requirement.
Assumes
There are 2 databases with this code: -
1. BookSale_2002.mdb - password = ABCD
2. BS2.mdb - password = 1234
They are the BookSale.mdb database, supplied by Microsoft in Visual Studio, with the tables split between them.
The 2 databases should be located in the same folder as the VB files.
Download Query2MDB (64 KB)