VBA SQL query is not retrieving from other user's computer

albertan

Board Regular
Joined
Nov 16, 2014
Messages
68
Office Version
  1. 365
Hello,

I have a VBA code to an SQL query with the following connection string (part of VBA):

With ActiveWorkbook.Connections("Data").OLEDBConnection
.BackgroundQuery = False
.CommandType = xlCmdSql
.connection = _
"OLEDB;Provider=SQLOLEDB.1;Password=PASSWORD;Persist Security Info=True;User ID=ADUSER;Data Source=SQLSERVER1;Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Use Encryption for Data=False;Tag with column collation when possible=False;Initial Catalog=DATABASE1"

I know we all can access to this SQL using the password and user name (as read only access), but for some reason when I run this VBA from another computer it is not being ran. What could be the reason?

I am using this connection string syntax based on manually recorded macro from my computer. I had to remove the workstatation ID from connection string, I thought this would work from other computers. But data is not being retrieved and I'm not getting an error message.
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.

Forum statistics

Threads
1,223,243
Messages
6,170,967
Members
452,371
Latest member
Frana

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