Question : Error message saying cannot connect to linked SQL Server

I have a function where I call an Access Query Def.  The query pulls data from our SQL server via linked tables.  When the function is called as VBA is executing, I get the error message:
Run Time Error 3151:
ODBC Connection to SQLServer failed.

However, when I execute the query directly in access, this error does not occur.  I am using a file data connection type.  The code and error point are attached.  I have verified that the query parameters are being properly passed in.  I have also deleted the connection to the linked tables and reimported them.  Any help will be greatly appreciated!
Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
Private Sub Get_MISPart(CustNum As String, CustPart As String)
blnPart = True
 
MsgBox "CustNum =  " & CustNum
MsgBox "Custpart = " & CustPart
 
Set qdf = db.QueryDefs("qryRMACrossCustPart")
qdf.Parameters("Custno") = CustNum
qdf.Parameters("CustPart") = CustPart
    
Set rsPart = qdf.OpenRecordset 'ERRORS HERE
If Not (rsPart.BOF And rsPart.EOF) Then
    rsPart.MoveFirst
    strMISPart = rsPart.Fields("MedallionPart")
    strMISRev = rsPart.Fields("fcpartrev")
    strDesc = rsPart.Fields("fdescript")
    strGroup = rsPart.Fields("fgroup")
    strClass = rsPart.Fields("fprodcl")
    dblCost = rsPart.Fields("fstdcost")

Answer : Error message saying cannot connect to linked SQL Server

very strange - i copied the application and relinked the access tables to the production set of data as opposed to the test database.  the error message has gone away. something very unrelated must have happened.  
Random Solutions  
 
programming4us programming4us