Solved

ODBC Call Failed when writing from MS Access to SQL Server Tables

Posted on 2014-07-25
3
1,697 Views
Last Modified: 2014-07-26
Hi all,

Following code creates a ODBC --Call Failed error. Works on some machines / fails on others - all on same network/same server.

Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Dim strSQL As String
Dim CurrentDate As Date

CurrentDate = Date

   Set dbs = CurrentDb
   strSQL = "SELECT * FROM dbo_usrClockCards"
   Set rst = dbs.OpenRecordset(strSQL, dbOpenDynaset, dbSeeChanges)

   rst.AddNew
   rst!userID = Me.txtUserID
   rst!ClockDate = CurrentDate
   rst!ClockTime = Format(Now, "yyyy-mm-dd hh:mm:ss")
   rst!ClockTypeID = 1
   rst.Update
   rst.Close

Set rst = Nothing
Set dbs = Nothing
0
Comment
Question by:SeanNij
3 Comments
 
LVL 57

Accepted Solution

by:
Jim Dettman (Microsoft MVP/ EE MVE) earned 500 total points
Comment Utility
Add some additional error handling as show here (enumerate the errors collection):

How To Get More Information on the ODBC Call Failed Error
http://support.microsoft.com/kb/161288

 to make sure your getting all the errors.  usually the first is a generic one (3146), which doesn't tell you anything.

Once you have those, you usually have a good idea of what's causing the problem.

Jim.
0
 
LVL 3

Expert Comment

by:Leo Alexander
Comment Utility
You write that it works on some machines and not others... same version of Access? Have you tried to do a compile and/or repair and compact?

Also,

dbo_usrClockCards

Is the ODBC connection setup properly for the above table? i.e. are you able to open that table from access within the Navigation Pane?
0
 
LVL 1

Author Closing Comment

by:SeanNij
Comment Utility
Jim, Thanks.

Sent me in the right direction. Got some other nebulous "ODBC Optional Feature not implemented" message. Turns out to be field type on the SQL Tables.
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now