vallury
9th June 2004, 07:56
I need to connect to a BaaN ERP from my windows based VB application for which I do have the access details. I am not able to find relevant ODBC drivers for the same.

Appreciate if you could help


Thanks

jack786
2nd July 2004, 11:15
I hope u no need to have odbc derivers to connect to baan via VB
and u can find VB code to connect to baan in this board just copy the code and put in form load it works

wgarcia
10th February 2005, 21:30
Certainly,
your you don't need to have installed odbc drivers to achieve the connection with baan via BV

I annex you a code example in a macro of excel simple.


Sub Correr_sesion_de_baan()
'
' Correr_sesion_de_baan Macro
' Macro grabada el 03/02/2005 por Willian Garcia
'

Dim ssql As String
Dim erreur As String
Dim errmess As String
Dim baanobj As Object
Dim codigo As String
Dim descripcion As String


Dim i As Integer
Dim error As String

cRow = 4
cColumn = 3
dRow = 4
dColumn = 4

If Worksheets("Conjuntos").Cells(cRow, cColumn) = "" Then
MsgBox "Código Conjunto no puede ser vacío"
Else
codigo = Worksheets("Conjuntos").Cells(cRow, cColumn)
descripcion = Worksheets("Conjuntos").Cells(dRow, dColumn)

do_update = "1"
Set baanobj = CreateObject("Baan.Application")

' ssql = "stpapi.put.Field(" & Chr(34) & "tcmab0105m000" & Chr(34) & ", " & Chr(34) & "tcmab005.conj" & Chr(34) & ", " & Chr(34) & "UNO" & Chr(34) & ")"
ssql = "stpapi.put.Field(" & Chr(34) & "tcmab0105m000" & Chr(34) & ", " & Chr(34) & "tcmab005.conj" & Chr(34) & ", " & Chr(34) & codigo & Chr(34) & ")"
erreur = baanobj.ParseExecFunction("ottstpapihand", ssql)
' ssql = "stpapi.put.Field(" & Chr(34) & "tcmab0105m000" & Chr(34) & ", " & Chr(34) & "tcmab005.dsca" & Chr(34) & ", " & Chr(34) & "Creado desde visual" & Chr(34) & ")"
ssql = "stpapi.put.Field(" & Chr(34) & "tcmab0105m000" & Chr(34) & ", " & Chr(34) & "tcmab005.dsca" & Chr(34) & ", " & Chr(34) & descripcion & Chr(34) & ")"
erreur = baanobj.ParseExecFunction("ottstpapihand", ssql)

baanobj.ParseExecFunction "ottstpapihand", "stpapi.insert(" & Chr(34) & "tcmab0105m000" & Chr(34) & "," & do_update & "," & Chr(34) & "errmess" & Chr(34) & ")"
errmess = Val(baanobj.ReturnValue)
If baanobj.error = 0 Then
MsgBox "Codigo de conjunto " & codigo & " añadido"
Worksheets("Conjuntos").Cells(13, 3) = codigo
Worksheets("Conjuntos").Cells(13, 4) = descripcion
Worksheets("Conjuntos").Cells(cRow, cColumn) = ""
Worksheets("Conjuntos").Cells(dRow, dColumn) = ""

End If
erreur = baanobj.ParseExecFunction("ottstpapihand", "stpapi.end.session(" & Chr(34) & "tcmab0105m000" & Chr(34) & "," & Chr(34) & "errmess" & Chr(34) & ")")
End If

End Sub