Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to use a UDF in SQL ?
Message
General information
Forum:
Visual Basic
Category:
Database DAO/RDO/ODBC/ADO
Miscellaneous
Thread ID:
00747648
Message ID:
00748481
Views:
26
Hmmm... I also remember doing something like this, and I am nearly certain that it was NOT DAO.

I will try to dig out the code when I have a few moments, probably tomorrow.

>I have tried creating a query that uses the UDF and it is not working. I have already used something like this but I can't remember in which project and I can't remember if it was DAO or an Access report.
>
>
>>My mistake, Steve. Somewhere along the line I thought you were hitting a SQL Server back end. I don't know enough about Access UDFs to comment too specifically. But I think that Eric's earlier comment suggesting that you create an Access query and execute the query is the right way to go. You can do this, IIRC, by using the connection's Execute() method and simply calling the public query... something like this:
>>
>>oRS = oConn.Execute("Q_MyQuery")
>>
>>>Vin,
>>>That is actually what I was trying to do:
>>>INSERT INTO tblTemp SELECT MyUDF(A.Full_name) AS LName FROM EMPLOYEES AS A
>>>
>>>I tried putting the Public MyDDF() in the SAME Form module, in another Class module, and in a Standard module.
>>>But, MyUDF() was always undefined. What is the "dbo." ? Any idea where I should put MyUDF()?
>>>
>>>BTW, I'm using VB6 and connecting to an Access97 database via ADO. Both tables are in the Access database.
>>>
>>>Thanks for trying to help.
>>>
>>>
>>>
>>>>>>
>>>You can, however call the UDF as part of a select statement to acheive the result:
>>>
>>>rs.open "SELECT dbo.MyUDF('param1', 'param2') AS Result"
>>><<<
The whole problem with the world is that fools and fanatics are always so certain of themselves, but wiser people so full of doubts. - Bertrand Russell
Previous
Reply
Map
View

Click here to load this message in the networking platform