Jon von der Heyden
MrExcel MVP, Moderator
- Joined
- Apr 6, 2004
- Messages
- 10,907
- Office Version
- 365
- Platform
- Windows
Hi All
I am querying an Access database using ADO in Excel VBA.
Is it possible to use a user-defined function in my SQL command text? I know I could house the UDF in Access and then set-up the query there, and then use excel to run that existing query, but I wonder if it is possible somehow to actually use the user-defined function directly in my SQL string in my Excel VBA sub-routine.
My user-defined function is just basicaly a long Select Case statement, so I could use a really long IIf statement in my SQL string but the UDF is so much tidier.
Any ideas?
Thanks
Jon
I am querying an Access database using ADO in Excel VBA.
Is it possible to use a user-defined function in my SQL command text? I know I could house the UDF in Access and then set-up the query there, and then use excel to run that existing query, but I wonder if it is possible somehow to actually use the user-defined function directly in my SQL string in my Excel VBA sub-routine.
My user-defined function is just basicaly a long Select Case statement, so I could use a really long IIf statement in my SQL string but the UDF is so much tidier.
Any ideas?
Thanks
Jon