Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Run Time error 3146 ODBC call failed

Avatar of Harter
HarterFlag for United States of America asked on
Microsoft Access
8 Comments1 Solution3890 ViewsLast Modified:
I am trying to call a stored procedure in SQL 2005 from Access 2003 front end.
The code is in Access module, and I have macro called AutoExec to run the code
when the user opens the database.
I am getting the error: "Run-time error 3146 ODBC call failed" password, userid and server are correct.
here is my code
Option Compare Database
Option Explicit
Public Function CompareAD2SQL()

Dim mydb As Database
Dim myq As QueryDef
Dim MyText As String

Set mydb = CurrentDb()
Set myq = mydb.CreateQueryDef("")
myq.ReturnsRecords = False
mydb.QueryTimeout = 4000
myq.ODBCTimeout = 5000
myq.SQL = "exec dbo.compare"
End Function
Avatar of Harter
HarterFlag of United States of America imageIT Analyst

Our community of experts have been thoroughly vetted for their expertise and industry experience.

This problem has been solved!
Unlock 1 Answer and 8 Comments.
See Answers