I am programming an Access 2007 (accdb, not adp) frontend at connect to a SQL Server 2005 backend. How can I call a scalar user defined function from my vba code?
+2
A:
Create a query that calls the function.
SELECT [FirstName], [Surname]
FROM dbo.FindCustomersOrderByDesc();
Ardman
2010-03-19 14:36:08
@Ardman, the function you calling here is a _table_ valued function. Do you know a simple way to call a _scalar_ function?
Skywalker
2010-03-19 15:26:03
Yes, just do a SELECT function. This will give you the results you want. I added the table valued function in order to show you it's the same method.
Ardman
2010-03-20 08:39:30
+1
A:
Dim rst As ADODB.Recordset
Set rst = Connection.Execute("SELECT dbo.MyFunction('" & Me.field & "')")
Charles Robinson
2010-03-19 21:05:24