Question

I created an MS Access Database that consists of about 25 ODBC Database Links that are connected to one table on each of these databases. Each of these tables have the same structure, but different data. Then, I Union these tables with a query so that I can have all the data available in one view.

The problem that I'm having, is that every time I try to use the query from a reporting software (Crystal Reports), I have to manually connect to all 25 databases, which is very tedious.

I made a VBA connection Script that connects to each of the databases using its log information, however I don't know how to trigger this code from an event like Opening the Query or something like that.

Any ideas?

Was it helpful?

Solution

You'll need to relink the tables in your Access Database on the "External Data" tab. When you get to the "Link Tables" dialog, make sure you click the "Save Password" option before clicking "OK". This will store the password information in the linked table definition. The linked tables you just created will be brought in with a "TableName1" name.

During this next step, DO NO OPEN YOUR QUERIES. They will break if you don't complete this step first.

Delete your original linked tables from the Access database. Then, remove the "1" from your new linked table names. This will effectively replace your original links with ones that have persistent password information.

I'm not 100% positive, but I believe this will fix your issue. I don't believe there is any way to trigger vba or any kind of macro when running your query from Crystal Reports, so your ODBC credentials need to be stored in the linked table definitions.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top