Joy Conner
28th September 2011, 18:34
I need to execute a VB script that will execute a BaaN dll.

I have written the BaaN library. The function returns true or false. There is one input parameter and one returned parameter.

I have written VB script that calls the BaaN library. The problem I am having is receiving the boolean and the return parameter.

Does anyone know how to do this?

Thanks in advance for your assistance.

Joy

mark_h
28th September 2011, 18:50
Try searching the AFS/DDC/OLE forum - you can try BAAN DLL, OLE, Excel. Not sure this thread helps (http://www.baanboard.com/baanboard/showthread.php?s=&threadid=1997&highlight=EXCEL+and+STPAPI) or not. There are others on getting values.

Joy Conner
28th September 2011, 23:16
Hi Mark - Thanks for responding.

I had already performed your recommended searches. Your script really helped. I think the root cause of my problem is I am getting a return value of -3. I have modiifed my library so that there are no input parameters and made the appropriate changes to vb code. In this case, the return value is 1.

When I turn on the first parameter which is a string, the return value is -3. According to your vb code a -3 indicates a syntax error in the function call.

Here is vb code:

PO$ = "PRO00111320"
dllname = "otijcnole0408"
dllfunction = "get.stone.data.tijcnole0408"
dllfunction = dllfunction & "("
dllfunction = dllfunction & PO$ 'PO number
dllfunction = dllfunction & ")"
BaanObj.ParseExecFunction(dllname, dllfunction)

Here is BaaN dll:

function extern domain tcbool get.stone.data.tijcnole0408(
domain tcrefa refa)

I don't think I need to use the $ when referending the PO string. I've tried with and without the $. Both return -3.

VB displays the content of dllfunction as get.stone.data.tijcnole0408(PRO00111320)

Do you see the problem?

- Joy

vinceco252
28th September 2011, 23:30
I think you may need to include quotes around the PO$ argument. So "dllfunction = dllfunction & chr(34) & PO$ & chr(34)" or something like that.

Joy Conner
28th September 2011, 23:40
Hi Vince,

I tried your suggestion and still get a return value of -3. Here is the content of dllfunction: "get.stone.data.tijcnole0408("PRO00111320")"

- Joy

vinceco252
28th September 2011, 23:43
Can you write a quick script in Baan to execute the function in the DLL to make sure there's not a problem in the function?

Joy Conner
28th September 2011, 23:45
Hi Vince - I've done that and stepped through the library. - Joy

Joy Conner
28th September 2011, 23:51
It's working.

Thanks
Joy

mark_h
29th September 2011, 05:47
What resolved the issue?

Joy Conner
4th October 2011, 14:50
The suggestion to put quotes around the string solved the problem.