Hi,
I've created a report that acquires accounting information from the server. It works fine for me but I want the file to work for other users as well. Other users work in different domains.
My query code is a standard "recorded" query that I created via Microsoft Query:
So my server username is "ksieg02". When I give the file with a query to other users outside that use another domain, there is a warning that the data couldn't be refreshed and there is a box prompting for the password. Is it possible to write the code for a universal connection?
I used this technique and I thought that code would "disguise" itself as me so that other users use my login and my trusted connection
I'm sorry if it was a stupid idea 
I've created a report that acquires accounting information from the server. It works fine for me but I want the file to work for other users as well. Other users work in different domains.
My query code is a standard "recorded" query that I created via Microsoft Query:
Code:
Sub Kwerenda_Płatnosci(Optional F As Integer)
With ActiveSheet.ListObjects.Add(SourceType:=0, Source:="ODBC;DRIVER=SQL Server;SERVER=MYSERVER;UID=ksieg2;APP=Microsoft Office 2010;WSID=KSIEG02-L;DATABASE=EP_15;Trusted_Connection=Yes", Destination:=Range("$A$1")).QueryTable
.CommandText = ("SELECT Platnosci.Podmiot, Platnosci.PodmiotType, Platnosci.DokumentType, Platnosci.Bufor, Platnosci.Termin, Platnosci.KwotaValue, Platnosci.Opis, Platnosci.NumerDokumentu, Platnosci.DataDokumentu, Platnosci.Kierunek" & Chr(13) & "" & Chr(10) & "FROM ep15_opisie.dbo.Platnosci Platnosci" & Chr(13) & "" & Chr(10) & "WHERE (Platnosci.PodmiotType='Kontrahenci')")
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.PreserveColumnInfo = True
.ListObject.DisplayName = "Kwerenda_Platnosci"
.Refresh BackgroundQuery:=False
End With
End Sub
So my server username is "ksieg02". When I give the file with a query to other users outside that use another domain, there is a warning that the data couldn't be refreshed and there is a box prompting for the password. Is it possible to write the code for a universal connection?
I used this technique and I thought that code would "disguise" itself as me so that other users use my login and my trusted connection

