UserDefined Function in query

RobatSara

New Member
Joined
Mar 25, 2004
Messages
9
I have written a function Called FiscalYear in Access that converts a date to a Fiscal Year. If I use it within an expression in an Access query everything runs fine. When I run the query via ADO to get the results to excel I get a Visual Basic error that says the expression holds an undefined function FiscalYear. Any ideas on how to solve this are more than welcome.
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
FiscalYear udf resides in Access environment as a custom function and you can only access it to use in queries within that project file.

Two possible solutions:

1- Executing your code in Access environment (might not be suitable for your project if getting information from Access is just a little part of the job in Excel).

2- Suitable solution: copy your FiscalYear function into the Excel module and create your query string by using this function first then use the returned string in ADO object.

I hope it helps.
Suat
 
Upvote 0

Forum statistics

Threads
1,221,845
Messages
6,162,350
Members
451,760
Latest member
samue Thon Ajaladin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top