1

I have a vba function in Access mdb file. I am trying to run a query from jdbc. while the query runs fine in access, from jdbc I get an error saying:

[Microsoft][ODBC Microsoft Access Driver] Undefined function 'fun' in expression

Here is a snippet of my code:

Class.forName ("sun.jdbc.odbc.JdbcOdbcDriver");
    String database = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=xyz.mdb;";
    Connection conn = DriverManager.getConnection(database,"","");  
Statement select = conn.createStatement();
    ResultSet result = select
    .executeQuery("SELECT * FROM table where fun()=1");
  • 3
    As far as I know msaccess jdbc driver does not involve vb scripts and macros upon executing SQL requests. Only pure SQL is allowed. –  Jul 26 '12 at 20:38
  • Similar question was here.. but does any one know for sure? http://stackoverflow.com/questions/11259240/calling-vba-function-in-access-from-java – user1555500 Jul 26 '12 at 20:55
  • 2
    You cannot use user defined functions in MS Access queries ourside of MS Access, as @RafaelOsipov says. – Fionnuala Jul 26 '12 at 20:56

0 Answers0