DanFuhrmann
Programmer
- Sep 22, 2008
- 7
I am writing an interface to insert orders and create invoices for ACCPAC Advantage 5.5A. Im using the COM objects.
In the past we insert the new order, change the invoice number, and then create the invoice.
Here's the code where I find the order, process any order header updats, and create the invoice
It fails when I try to set the INVNUMBER saying its a readonly field. This worked in prior versions.
If I dont try and assign the ivoice number it creates an invoice with the next number. Anyone know how I can update that invoice number now?
In the past we insert the new order, change the invoice number, and then create the invoice.
Here's the code where I find the order, process any order header updats, and create the invoice
Code:
'Open all the views
dbACCPAC.OpenView "OE0520", vwOH
dbACCPAC.OpenView "OE0500", vwOD
dbACCPAC.OpenView "OE0680", vwSN
dbACCPAC.OpenView "OE0180", vwCmts
dbACCPAC.OpenView "OE0740", vwPS
dbACCPAC.OpenView "OE0522", vwOF
dbACCPAC.OpenView "OE0526", vwOFQ
dbACCPAC.OpenView "OE0501", vwODOF
dbACCPAC.OpenView "OE0502", vwKD
dbACCPAC.OpenView "OE0503", vwKS
dbACCPAC.OpenView "OE0504", vwBOM
'Call Compose method on all the views
vwOH.Compose Array(vwOD, vwSN, vwCmts, vwPS, vwOFQ, vwOF)
vwOD.Compose Array(vwOH, vwODOF, vwKS, vwKD) 'change vwBOM to vwKS
vwSN.Compose Array(vwOH, vwOD)
vwCmts.Compose Array(vwOH, vwOD)
vwPS.Compose Array(vwOH)
vwOF.Compose Array(vwOH)
vwOFQ.Compose Array(vwOH)
vwODOF.Compose Array(vwOD)
vwKD.Compose Array(vwOD, vwBOM) 'changed vwKS to vwBOM
vwKS.Compose Array(vwOD) 'changed vwKD to vwOD
vwBOM.Compose Array(vwKD) 'changed vwOD to vwKD
'Search for Order
vwOH.Order = 1
vwOH.Browse "ORDNUMBER=""" & vstrOrderNumber & """", True
.
. Update header code here
.
'Process Header Update
vwOH.Process
'Update invoice number
vwOH.Fields("INVNUMBER").Value = rstInvHeader("InvoiceNumber")
'Tell it to produce the invoice
vwOH.Fields("INVPRODUCE").Value = 1
'Do the create
vwOH.Update
It fails when I try to set the INVNUMBER saying its a readonly field. This worked in prior versions.
If I dont try and assign the ivoice number it creates an invoice with the next number. Anyone know how I can update that invoice number now?