minizao
16th February 2005, 21:03
Hi all,

I need to fill in session tdsls4120m000 the field tdsls045.dqua or tdsls045.bqua, i did the following function and it's not working.
I don't know where is problem.
Can anyone help me... pleaaasssseeeeee :cool:

i have some questions :
(1) I have to execute find when i fill "Order Number" and "Position" and then Get?

(2) I need to fill Date field?

(3) To submit this values i did this :
3.1 - Mark current record, it's correct how i did it?
3.2 - Executed Update
3.3 - Executed Save
3.4 - End session
Are those the correct steps to submit the values that i have inserted?


Public Sub ManterEntregas(ByVal OrdVenda As String, ByVal NrPosicao As String, ByVal QtdEntregue As String, ByVal DataEntrega As String)

Dim Ret, ErrMessage1 As String

dllName = BAANManterEntregasdll

'Fill field orno
dllFunction = "tdsls4120m000f.put.Ordem_de_venda.tdsls045.orno(" + OrdVenda + ")"
Call SendToBAAN(dllName, dllFunction)

'Fill field pono
dllFunction = "tdsls4120m000f.put.N_mero_de_posi_o.tdsls045.pono(" + NrPosicao + ")"
Call SendToBAAN(dllName, dllFunction)
'Find fields
dllFunction = "tdsls4120m000f.find()"
Call SendToBAAN(dllName, dllFunction)
MsgBox("find : " + BAANObj.returnvalue.ToString)
'1 - Exist

'Get fild orno
dllFunction = "tdsls4120m000f.get.Ordem_de_venda.tdsls045.orno()"
Call SendToBAAN(dllName, dllFunction)

'Get field pono
dllFunction = "tdsls4120m000f.get.N_mero_de_posi_o.tdsls045.pono()"
Call SendToBAAN(dllName, dllFunction)

'Fill field dqua
dllFunction = "tdsls4120m000f.put.Qtd._entregue(" + QtdEntregue + ")"
Call SendToBAAN(dllName, dllFunction)

'Fill field ddat
dllFunction = "tdsls4120m000f.put.Data_entrega(" + DataEntrega + ")"
Call SendToBAAN(dllName, dllFunction)

'Fill field bqua
dllFunction = "tdsls4120m000f.put.Pendente(0.00)"
Call SendToBAAN(dllName, dllFunction)

'Function to mark the current record in session tdsls4120m000
ErrMessage1 = "errmessage1"
dllFunction = "tdsls4120m000f.mark(" + Chr(34) + ErrMessage1 + Chr(34) + ")"
Call SendToBAAN(dllName, dllFunction)

'Function to update a record in session tdsls4120m000
'Record must be made current and fields to be changed before calling this function
ErrMessage1 = "errmessage1"
do_update = "1"
dllFunction = "tdsls4120m000f.update(" + do_update + "," + Chr(34) + ErrMessage1 + Chr(34) + ")"
Call SendToBAAN(dllName, dllFunction)

'Function to save an update/insert/delete in session tdsls4120m000
ErrMessage1 = "errmessage1"
dllFunction = "tdsls4120m000f.save(" + Chr(34) + ErrMessage1 + Chr(34) + ")"
Call SendToBAAN(dllName, dllFunction)

Ret = BAANObj.ReturnValue.ToString
ErrMessage1 = BAANObj.FunctionCall.ToString
If Ret <> "1" Then
MsgBox("Update with SUCCESS...")
Else
MsgBox("ERROR UPDATING...")
End If

ErrMessage1 = "errmessage1"
dllFunction = "tdsls4120m000f.end(" + Chr(34) + ErrMessage1 + Chr(34) + ")"
Call SendToBAAN(dllName, dllFunction)

'Disconnecting from BAAN
DisconnectBAAN()

End Sub



Best regards,

Nuno Mota

mark_h
16th February 2005, 21:47
The steps you outlined are correct. Since you are filling a date field it is probably the format that VB uses for the date. It seems to me there are some posts in this forum about how you should have dates. You can search this forum for Dates and probably DLL to find the posts.

Mark

mark_h
16th February 2005, 21:49
Check this post out (http://www.baanboard.com/baanboard/showthread.php?t=7409&highlight=OLE+dates).

Mark

minizao
17th February 2005, 14:18
I Mark... Thank you for your help.

I have passed the date in number of days and it's working well. I think :eek:

I did this :

'Fill field ddat
'Convert Date to Number of Days
'I don't know why but i have a difference of one day?!?!?!?
DataEntrega = DateDiff("d", "1/1/0001", DataEntrega) + 1

dllFunction = "tdsls4120m000f.put.Data_entrega(" + DataEntrega + ")"
Call SendToBAAN(dllName, dllFunction)

Thank you VERY MUCH :D

Regards,

Nuno