Hi Folks,
I have a PB/Win 9.01 COM server application that I use successfully from within the Microsoft Access 2003 VBA environment. Everything works fine when all method parameters are passed to the COM server from VBA, however I would like to specify an optional method parameter.
I get a VBA compile error saying 'Argument not optional' even though the PB method parameter clearly has OPTIONAL specified.
Am I missing something simple? I would appreciate any ideas or comments.
Thanks,
David
(example un-compiled PB/Win 9.01 COM server code )
Access 2003 VBA
I have a PB/Win 9.01 COM server application that I use successfully from within the Microsoft Access 2003 VBA environment. Everything works fine when all method parameters are passed to the COM server from VBA, however I would like to specify an optional method parameter.
I get a VBA compile error saying 'Argument not optional' even though the PB method parameter clearly has OPTIONAL specified.
Am I missing something simple? I would appreciate any ideas or comments.
Thanks,
David
(example un-compiled PB/Win 9.01 COM server code )
Code:
#COMPILE DLL "SERV.DLL #DIM ALL #COM NAME "Server",1.0 #COM DOC "Server" #COM GUID GUID$("{133A366D-A5A7-46F6-96D8-2CC9340CC24D}") #COM TLIB ON $cFuncGuid = GUID$("{522FBD0C-C345-49A5-9B55-709048226DE8}") $iFuncGuid = GUID$("{255A2473-9BF2-4252-AF80-21B89C467134}") CLASS cFunc $cFuncGuid AS COM INTERFACE iFunc $iFuncGuid : INHERIT DUAL METHOD testoptional<136> (OPTIONAL BYVAL s_param AS VARIANT) AS LONG IF NOT ISMISSING (s_param) THEN MSGBOX "Parameter passed : " & VARIANT$(s_param) METHOD = %TRUE ELSE MSGBOX "No parameter passed." METHOD = %FALSE END IF END METHOD END INTERFACE END CLASS
Access 2003 VBA
Code:
Public Function testoptional() Dim l_result As Long Set oFnc = New CFUNC ' 1) method called successfully with a parameter l_result = oFnc.testoptional("XYZ") ' 2) causes a 'Microsoft Visual Basic compile error : Argument not optional' l_result = oFnc.testoptional() Set oFnc = Nothing End Function
Comment