I am trying to connect to a SQL via VBA Code on Excel.
The problem is that when I am logged in on my username, I can connect to the database without problem. But when I try to connect with other user logged in, the connection is unsucessful.
I have already created a user inside my Database, like the picture below:
And my connection on VBA is being done this way:
Option Explicit
Public DB As New ADODB.Connection
Public RST As New ADODB.Recordset
Public caminho, strConn As String
Public Msg As String
Sub CONECTA_DB()
strConn = "Provider=SQLOLEDB;Data Source=BR1104053\SQLEXPRESS;" & _
"Initial Catalog=BDVestiario;" & _
"Integrated Security=SSPI;" & _
"User ID=bdvestiario;" & _
"Password=#infra#sudeste#;"
Set DB = New ADODB.Connection
Set RST = New ADODB.Recordset
DB.Open strConn
RST.CursorLocation = adUseClient
This gives a connection error when logged on other user, but connects normally when I am loggen on my user.
The problem, is that I need all my company to use this excel sheet connecting to SQL, so I need a common username to read and write on the database.
