Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2014-07-25
3
Medium Priority
?
1,986 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 58

Accepted Solution

by:
Jim Dettman (Microsoft MVP/ EE MVE) earned 2000 total points
ID: 40219896
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
ID: 40220542
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
ID: 40222222
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
In a use case, a user needs to close an opened report by simply pressing the Escape (Esc) key. This can be done by adding macro code in Report_KeyPress or Report_KeyDown event.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…

963 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