joygomez
asked on
ODBC connection fails in MS Access Pass through query
In MS Access... in Pass through query... when executing, I am getting this error 'ODBC - connection to STW failed'.
This is what I have in the Pass through query.
exec CaculateVariableFixedTimes '41428' , '2018-01-01' , '2'
The stored procedure works perfectly when I run it in SQL. This used to work properly when I had my SQL on my local machine. Now I am connecting to a server. I am guessing that is the issue. I am able to connect to my tables and queries properly.
This is what I have in the Pass through query.
exec CaculateVariableFixedTimes
The stored procedure works perfectly when I run it in SQL. This used to work properly when I had my SQL on my local machine. Now I am connecting to a server. I am guessing that is the issue. I am able to connect to my tables and queries properly.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you... i have resolved it...
ASKER
strConnect = "ODBC;Driver={SQL Server};Server=" & rsTables!ServerName & ";Database=" & rsTables!DatabaseName & ";Trusted_Connection=True"
I am calling this from a event and this is what i have as below... Where below should i place the connection string?
Private Sub Form_Close()
Dim qdf As QueryDef
Set qdf = CurrentDb.QueryDefs("PassT
qdf.SQL = "exec CaculateVariableFixedTimes
qdf.Execute