zlong2
14th November 2006, 03:32
I use VB API read data from Baan. Sometimes or about 10% cases, there is a Baan Automation Error at "olesql_parse" when reading a BOM from Baan, specially after finishing a BOM editing in Baan or even a Baan BOM window is open. The codes are:

Set Baanobj = CreateObject("Baan.Application.baanprod")
Baanobj.Timeout = 10
On Error GoTo BaanAutomationError

' get the part number
PartN = PartNumber
PartN = Chr(34) & String(9, " ") & UCase(Trim(PartN)) & Chr(34) & Chr(34) & " " & Chr(34) & ")"

' Form the query function

B_function = "olesql_parse(""select tibom010.pono,tibom010.seqn,tibom010.sitm,tibom010.indt,tibom010.exdt,tibom010.qana from tibom010 where tibom010._compnr = 110 and tibom010.mitm = """

B_function = B_function + PartN
' Execute the function olesql_parse from DLL ottdllsql_query
Baanobj.ParseExecFunction "ottdllsql_query", B_function


this code is used in both AutoCAD and Solidowrks program. Any suggestion will be appreciated very much.

Darren Phillips
14th November 2006, 10:08
It maybe unrelated to your problem but I find compiling a DLL and and making calls to the DLL works much better than using the code directly.

zlong2
21st November 2006, 01:29
Thanks, Darren.
I tried to move the Baan BOM to a different Assembly before runing the code. So far, no problem reported.