Making same change to multiple++ Data Connections. Can VBA help?

Rachel Garrett

New Member
Joined
May 13, 2008
Messages
11
Greetings,

I have to update a collection of a couple dozen Excel scorecards that pull their data from Access. Each scorecard has three Data Connections to the database; the database contains three different queries constructed to supply their piece of the data.

One thing I discovered while playing around is that when I set up a data connection by telling Excel to look at an Access query, it just copies in the SQL -- it doesn't actually point to the query. So instead of just being able to tweak three queries in the database in order to make a change, I will have to manhandle about 90 data connections.

The operation I have to do on each connection is identical:

1) Stop returning fields A, B, and C when the connection refreshes.
2) Add fields X, Y, and Z in their place.

Does anyone have suggestions on a good approach? I was thinking maybe VBA could edit the connection strings for me. (I don't consider VBA part of my skillset, so if you used advanced concepts, example code would be extremely helpful.)

Thank you very much for the help.

--Rachel
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
I may have found a solution. I just found a lengthy tutorial from Microsoft on how to do this, using OpenXML.
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p> </o:p>
Not sure what that is or how to use it – yet. :)
 
Upvote 0
I have to update a collection of a couple dozen Excel scorecards that pull their data from Access. Each scorecard has three Data Connections to the database; the database contains three different queries constructed to supply their piece of the data.

One thing I discovered while playing around is that when I set up a data connection by telling Excel to look at an Access query, it just copies in the SQL -- it doesn't actually point to the query. So instead of just being able to tweak three queries in the database in order to make a change, I will have to manhandle about 90 data connections.

Can you post a few sample data connections? Leave out passwords if they are found in the strings please - and anything else potentially sensitive.

The link you found requires Microsoft Visual Studio for creating custom forms (if you are going to follow their tutorial) - that's not standard with your Office suite.
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,208
Members
452,618
Latest member
Tam84

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top