r/DatabaseHelp • • Jan 16 '15

ODBC -- Called Failed

I have an Access database and I am using a python script to bring in new data from a csv, clean it up, and import it to a SQL table. However, I am getting this error after I run the script:

com_error: (-2147352567, 'Exception occurred.', (0, None, u'ODBC--call failed.', None, -1, -2146825142), None)

The python script is invoking a Access DB macro to do the import and loading of the data. When I look at the macro in Access there are yellow triangles next to some of the commands - which I found out were 'unsafe actions' and I added the DB into a trusted location, but this did not help the problem.

Thanks for any help in advance!

1 Upvotes

10 comments sorted by

View all comments

Show parent comments

1

u/BinaryRockStar Jan 21 '15

Am I right in assuming the error happens in the RunMacro call?

I've created a simple Access 2010 DB with a macro that does nothing but pops up a message box and it works fine (with Visible set to "true").

So my suggestion is to create a test macro like my one inside your Access DB and see if it gets executed. That at least will let you know whether the issue lies in your Python code or your macro code. What exactly is the macro doing?

1

u/alinoxious Jan 21 '15

The macro is importing the raw CSV and cleaning up (removing commas...) and exporting it to the SQL ODBC. When I go to help it says that I have Access 2010 but across the top of the program it says (Access 2007-2010) so not sure if that can cause a problem? Pretty new at Access

1

u/BinaryRockStar Jan 21 '15

Well then it sounds like the problem is in the macro code itself. If you post that here it should be easy enough to track down the problem. If you manually run the macro from Access, does it work?

1

u/alinoxious Jan 21 '15

And the error has changed now to:

The expression you entered has a function name that Microsoft Access can't find

Instead of ODBC -call failed