on 2020 Nov 13 6:43 PM
The following code is throwing an error:
Exception has been thrown by the target of an invocation. - Conversion from string "13/11/2020" to type 'Date' is not valid
Code:
<br>Dim HeaderQuery As String ="SELECT top 1 DocDate FROM OIGE WHERE DocNum = 1039"
Dim RetVal As Long
Dim ErrCode As Long
Dim ErrMsg As String
Dim SCVal As Long
Dim SOEntry as String
Dim oRecordSet As SAPbobsCOM.Recordset
Dim lineRecordSet As SAPbobsCOM.Recordset
oRecordSet = company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
lineRecordSet = company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
oRecordSet.DoQuery(HeaderQuery)
While oRecordSet.EoF = False
Dim DetailSOQuery As String ="SELECT 'PM1019-2XL' , 1"
Dim vSO As SAPbobsCOM.Documents
vSO = company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInventoryGenEntry)
vSO.DocDate = Date.Now.ToString("dd/MM/yyyy")
lineRecordSet.DoQuery(DetailSOQuery)
While lineRecordSet.EoF = False
vSO.Lines.ItemCode = lineRecordSet.Fields.Item(0).Value
vSO.Lines.Quantity = lineRecordSet.Fields.Item(1).value
vSO.Lines.Add()
lineRecordSet.MoveNext()
End While
RetVal = vSO.Add
If RetVal <> 0 Then
company.GetLastError(ErrCode, ErrMsg)
application.messagebox(ErrCode & " " & ErrMsg)
End If
oRecordSet.MoveNext()
End While
Request clarification before answering.
User | Count |
---|---|
93 | |
39 | |
8 | |
5 | |
3 | |
3 | |
3 | |
2 | |
2 | |
2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.