Greetings:
I have an Access 2002 database query that works fine within Access, returning the name of the month, the year, and some summarized data grouped by month. However, when I call that query to populate a DataSet in my VB front end, an error is thrown "Undefined function 'MONTHNAME' in expression". What's up with that I could work around this, and have VB do the month names, but I'd rather it all be handled within the query.
Thanks!

MS Access function MonthName causing error in VB
JimM5
Custom user-written VBA functions as well as many built-in VBA language functions are executed by Microsoft Access when embedded in a SQL query. Unfortunately the functions available to the Jet database engine are limited (when executed via ADO, ADO.NET, etc.). You can find a list of those available in the following MS KB article:
How to configure Jet 4.0 to prevent unsafe functions from running in Access 2000 and Access 2002
Uwe82
That’s an interesting point. I don’t know whether the Jet (Access) OleDb provider supports stored procedures. I also assume your CommandText is simply “QueryName”. I don’t know Access that well, and I don’t know how it would behave.
I would use CommandType=Text and CommandText=”SELECT * FROM QueryName”.
Zlatko
Mihir_Soni_bcdb9d
Can you add an extra level of indirection to your query in Access For instance:
SELECT *
FROM [your original query]
And then use this simple form from your app.
Zlatko
djbjmb
Thanks Zlatko
I like the idea, but I'm still getting the error using that technique.
"And then use this simple form from your app."
I'm using CommandType=StoredProcedure, so none of the SQL is in my app. That's not something that would make a difference, is it
Thanks again
varunsagii