Link to home
Start Free TrialLog in
Avatar of SeanNij
SeanNijFlag for South Africa

asked on

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

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
ASKER CERTIFIED SOLUTION
Avatar of Jim Dettman (EE MVE)
Jim Dettman (EE MVE)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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?
Avatar of SeanNij

ASKER

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.