SQL call to VBA, named or omitted parameters syntax?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi
I have an SQL statement that makes calls to VBA functions, like this
SELECT f1, f2, usrfncCalculate(f3, f4, f5) as f
FROM Table

Where usrFncCalculate is a VBA function that looks like this
FUNCTION usrFncCalculate(P1 as string, OPTIONAL P2 as variant, OPTIONAL P3 as variant) as Strin
if not IMISSING(P2) then...
end functio

Can anyone point me to some documentation about the rules on calling VBA functions from SQL like this
For example the rules on Paramater arrays, named parameters, and missing parameters

Apparently you are not allowed to specify named parameters like this: SELECT usrFncCalculate(P1: = "Larry")
And you are not allowed to omit parameters like this: SELECT usrFncCalculate("Larry", , "Brown"
Can anyone confirm that there is no way to specify named parameters, or missing parameters with the two comma method
Thanks in advance.
 
Optional parameters are ok if they are followed by another parameter.


Larry Brown said:
Hi:
I have an SQL statement that makes calls to VBA functions, like this:
SELECT f1, f2, usrfncCalculate(f3, f4, f5) as f6
FROM Table1

Where usrFncCalculate is a VBA function that looks like this:
FUNCTION usrFncCalculate(P1 as string, OPTIONAL P2 as variant, OPTIONAL P3 as variant) as String
if not IMISSING(P2) then....
end function

Can anyone point me to some documentation about the rules on calling VBA functions from SQL like this?
For example the rules on Paramater arrays, named parameters, and missing parameters?

Apparently you are not allowed to specify named parameters like this:
SELECT usrFncCalculate(P1: = "Larry").
And you are not allowed to omit parameters like this: SELECT
usrFncCalculate("Larry", , "Brown")
Can anyone confirm that there is no way to specify named parameters, or
missing parameters with the two comma method?
 
I mean, optional parameters are OK if they are NOT followed
by a parameter value.
 
Back
Top