Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2014-07-25
3
Medium Priority
?
1,930 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
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…

660 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