ODBC Call Failed

Leesha
BronzeLounger
Posts: 1487
Joined: 05 Feb 2010, 22:25

ODBC Call Failed

Post by Leesha »

Hi,
I have a database that is in Access 2010 with tables linked to sql server 2012. There is a duplicates query that has run fine for months but now is giving the user the ODBC call failed error. A select query run against that same table doesn't cause issues. When I run it on my local laptop I don't get the error. I'm not sure where to begin to look for the issues.
Thanks,
Leesha

User avatar
HansV
Administrator
Posts: 78443
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: ODBC Call Failed

Post by HansV »

What is the error number, and what is the text of the error message?
Best wishes,
Hans

Leesha
BronzeLounger
Posts: 1487
Joined: 05 Feb 2010, 22:25

Re: ODBC Call Failed

Post by Leesha »

Hi Hans,
There error message number when the query is run from a form is 3146. The text is "Run-time error '3146: ODBC - Call failed. The debug points to a query which is a find duplicates type of query. If I run the query by itself without the form there is no message number and the text simply states OCBC - call failed.
Leesha

User avatar
HansV
Administrator
Posts: 78443
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: ODBC Call Failed

Post by HansV »

Could you try the following:
Copy the following code into a module:

Code: Select all

Sub Test()
    Dim dbs As DAO.Database
    Dim rst As DAO.Recordset
    Dim der As DAO.Error
    On Error GoTo ErrHandler
    Set dbs = CurrentDb
    Set rst = dbs.OpenRecordset("SELECT * FROM [qryDuplicates]")
    rst.Close
    Exit Sub
ErrHandler:
    For Each der In DBEngine.Errors
        MsgBox der.Number & " - " & der.Description
    Next der
End Sub
Substitute the name of your duplicates query for qryDuplicates.
Run this procedure (click anywhere in the code and press F5).
Do you get more detailed error messages?
Best wishes,
Hans

Leesha
BronzeLounger
Posts: 1487
Joined: 05 Feb 2010, 22:25

Re: ODBC Call Failed

Post by Leesha »

It comes back with "3061 - too few parameters. Expected 2"

User avatar
HansV
Administrator
Posts: 78443
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: ODBC Call Failed

Post by HansV »

That means that the query refers to something that isn't recognized as an existing field name. Have you removed fields from the table, or renamed fields?
Best wishes,
Hans

Leesha
BronzeLounger
Posts: 1487
Joined: 05 Feb 2010, 22:25

Re: ODBC Call Failed

Post by Leesha »

No there haven't been any changes to the tables that I've made and I'm the only one would be making the changes. I'm downloading their backup to my home computer to see if I get the same error, which I am not getting now. The tables I am currently testing on at home are only 4 days old so it will be interesting to see if I get the same error. I'll let you know.
Thanks!
Leesha

Leesha
BronzeLounger
Posts: 1487
Joined: 05 Feb 2010, 22:25

Re: ODBC Call Failed

Post by Leesha »

I never did find any changes to the tables. I ended up rewriting the query so it appears that somehow the query got corrupted.
Thanks!
Leesha

User avatar
Rudi
gamma jay
Posts: 25455
Joined: 17 Mar 2010, 17:33
Location: Cape Town

Re: ODBC Call Failed

Post by Rudi »

TX 4d feedback.
Glad u came right!
Regards,
Rudi

If your absence does not affect them, your presence didn't matter.