I am encountering a problem trying to update ICPRIC.
I am using VB6 and Accpac 5.4.
The problem exists directly after the .read statement. The values being passed to the fields are not being accepted and testing only shows the default value.
I have run a macro and have tried various combinations of .init, .putwithoutverification, .read, .browse/.fetch and its all the same result. After .read section, the passed values are not stored before the update.
Any help would be greatly appreciated.
I am using VB6 and Accpac 5.4.
The problem exists directly after the .read statement. The values being passed to the fields are not being accepted and testing only shows the default value.
Code:
Dim ICPRIC As AccpacCOMAPI.AccpacView
Dim ICPRTX As AccpacCOMAPI.AccpacView
Dim ICPRICC As AccpacCOMAPI.AccpacView
Dim ICPRICP As AccpacCOMAPI.AccpacView
Dim i As Integer
On Error GoTo ERR_Handler
CISDBLink.OpenView "IC0480", ICPRIC
CISDBLink.OpenView "IC0490", ICPRTX
CISDBLink.OpenView "IC0481", ICPRICC
CISDBLink.OpenView "IC0482", ICPRICP
'N=Nothing for shortened code in this post
ICPRIC.Compose Array(ICPRTX, N, N, N, N, N, ICPRICC, ICPRICP, N, N, N)
ICPRTX.Compose Array(ICPRIC, N, N)
ICPRICC.Compose Array(ICPRIC)
ICPRICP.Compose Array(ICPRIC, N)
'// Customer information.
With ICPRIC
.Fields("ITEMNO").Value = flgItem.TextMatrix(pRowNum, 0)
For i = 1 To UBound(m_strPLCode, 2) '// 2 is for a two dimensional array.
.Fields("PRICELIST").Value = m_strPLCode(pRowNum, i)
If Trim$(m_strPLCode(pRowNum, i)) <> "" Then
If .Read Then
.Fields("DSALEPRICE").Value = flgItem.TextMatrix(pRowNum, 1)
.Fields("DSALESTART").Value = DateSerial(Year(flgItem.TextMatrix(pRowNum, 2)), Month(flgItem.TextMatrix(pRowNum, 2)), Day(flgItem.TextMatrix(pRowNum, 2)))
.Fields("DSALEEND").Value = flgItem.TextMatrix(pRowNum, 3)
.Update
.Post
Else
MsgBox "Item number " & flgItem.TextMatrix(pRowNum, 0) & " with price list code " & .Fields("PRICELIST") & " does not exist.", vbOKOnly + vbExclamation + vbApplicationModal + vbDefaultButton1, "Cannot Find Item"
End If
End If
Next i
.Close
End With
Set ICPRIC = Nothing
Set ICPRTX = Nothing
Set ICPRICC = Nothing
Set ICPRICP = Nothing
Exit Function
I have run a macro and have tried various combinations of .init, .putwithoutverification, .read, .browse/.fetch and its all the same result. After .read section, the passed values are not stored before the update.
Any help would be greatly appreciated.