Curious problem with an Excel spreadsheet which uses Excel VBA to connect to our SQL 2005 database.
EXCEL VBA CODE
szConnect = "Provider=SQLOLEDB;Data Source = " & g_strSQL_SERVER_IP & ";User ID = SQLDBUSER; password = sqldbuserpassword; Initial Catalog = DBNAME"
g_strUser = GetWindowsLogin
-- calls a proc to validate the individual user's Windows login on a specific table
-- but we know these users DO exist on that specific DB table
sCommand = "exec sproc_CHECK_VALID_USER '" & g_strUser & "'"
MsgBox "DEBUG1: Issuing db call " & sCommand & " ........", vbOKOnly, "Debug Message"
Set rsData = objConn.Execute(sCommand)
MsgBox "DEBUG1: Back from db call " & sCommand & " ........", vbOKOnly, "Debug Message"
Users in UK can use this spreadsheet and successfully see data from database, but we've been getting reports that users abroad (eg Dubai) have been getting the following Connection error when using the spreadsheet :
[DBNETLIB][ConnectionOpen(Connect())]SQL Server does not exist or access denied
The database connection code in the Excel VBA code is the same for all users regardless of their location.
The Excel VBA connects as SQL Server user 'SQLDBUSER' with password 'sqldbuserpassword' and we know these SQL login credentials are working OK.
We added various debug messages into the Excel VBA code g_strSQL_SERVER_IP correctly has the name of our SQL Server instance, and g_strUser correctly has the name of the user's Windows login.
For all our UK users, we see the DEBUG1 messages and they can access the spreadsheet without any problems. For our Dubai users, they do not even see the DEBUG1 messages but just get the [DBNETLIB] error shown above - so it looks as though for them the code fails on the
objConn.Open szConnect statement.
In SSMS, SQLOLEDB is listed as a Provider under Server Objects..Linked Servers..Providers.
What's got us stumped is that our UK users aren't having any problems, but our Dubai users are getting the error shown earlier - so would appreciate any help here, thanks ...