My application has a Windows 7/Access 2010 front end to a SQL Server 2008 R2 back end. It generally uses ADODB to access the data, but sometimes (for example when using QueryDefs for Reports) it uses DAO. This works fine for me, but my colleagues have a problem: the ADODB parts work fine for them, but as soon as they try to open a DAO part they get an error message: "Run time error 3151: ODBC-connection to '{SQL Server Native Client 10.0}<servername>' failed".
Our IT department has not been able to come up with a solution. Any suggestions would be welcome.
Code:
Public pubQdf As QueryDef, pubServerNaam as String, pubDatabaseNaam as String, pubSqlString as String [defined module level]
Private priDAO_rs As Recordset
pubServerNaam= "MyServerName"
pubDatabaseNaam ="MyDatabaseName"
pubSQlString= "SELECT ...”
Set pubQdf = CurrentDb.QueryDefs("pubQueryDef")
With pubQdf
.Connect = "ODBC;Driver={SQL Server Native Client 10.0};Server=" & pubServerNaam & ";Database=" & pubDatabaseNaam & "; Trusted_Connection=yes"
.SQL = pubSqlString
End With
Set priDAO_rs = pubQdf.OpenRecordset(dbOpenDynaset) <=works for me; error message here for colleagues
Our IT department has not been able to come up with a solution. Any suggestions would be welcome.