Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Dim mDBLinkCmpRW As AccpacCOMAPI.AccpacDBLink
Dim ARbatch As AccpacCOMAPI.AccpacView
Dim ARheader As AccpacCOMAPI.AccpacView
Dim ARdetail1 As AccpacCOMAPI.AccpacView
Dim ARdetail2 As AccpacCOMAPI.AccpacView
Dim ARdetail3 As AccpacCOMAPI.AccpacView
Dim ARdetail4 As AccpacCOMAPI.AccpacView
Sub MainSub()
'
On Error GoTo ACCPACErrorHandler
'open DB
Set mDBLinkCmpRW = OpenDBLink(DBLINK_COMPANY, DBLINK_FLG_READWRITE)
'Open views
mDBLinkCmpRW.OpenView "AR0031", ARbatch
mDBLinkCmpRW.OpenView "AR0036", ARheader 'AROBL
'mDBLinkCmpRW.OpenView "AR0032", ARheader 'ARIBH
mDBLinkCmpRW.OpenView "AR0033", ARdetail1
mDBLinkCmpRW.OpenView "AR0034", ARdetail2
mDBLinkCmpRW.OpenView "AR0402", ARdetail3
mDBLinkCmpRW.OpenView "AR0401", ARdetail4
'Compose views
ARbatch.Compose Array(ARheader)
ARheader.Compose Array(ARbatch, ARdetail1, ARdetail2, ARdetail3, Nothing)
ARdetail1.Compose Array(ARheader, ARbatch, ARdetail4)
ARdetail2.Compose Array(ARheader)
ARdetail3.Compose Array(ARheader)
ARdetail4.Compose Array(ARdetail1)
'get AR header
ARheader.GoTop
Do
If ARheader.Fields("IDINVC") = "IN000689" Then
Exit Do
End If
Loop While ARheader.GoNext
'update invoice
If ARheader.Fields("IDINVC") = "IN000689" Then
Test = ARheader.Fields("DATEDUE").Value
ARheader.Fields("DATEDUE").Value = DateSerial(2011, 8, 13) ' Due Date
ARheader.Process
ARheader.Update
End If
Set mDBLinkCmpRW = Nothing
Exit Sub
Private Sub cmdUpdate_Click()
Dim intDay, intMonth, intYear As Integer
Set mDBLinkCmpRW = OpenDBLink(DBLINK_COMPANY, DBLINK_FLG_READWRITE)
'Open views
mDBLinkCmpRW.OpenView "AR0031", ARbatch
mDBLinkCmpRW.OpenView "AR0036", ARheader 'AROBL
mDBLinkCmpRW.OpenView "AR0033", ARdetail1
mDBLinkCmpRW.OpenView "AR0034", ARdetail2
mDBLinkCmpRW.OpenView "AR0402", ARdetail3
mDBLinkCmpRW.OpenView "AR0401", ARdetail4
'Compose views
ARbatch.Compose Array(ARheader)
ARheader.Compose Array(ARbatch, ARdetail1, ARdetail2, ARdetail3, Nothing)
ARdetail1.Compose Array(ARheader, ARbatch, ARdetail4)
ARdetail2.Compose Array(ARheader)
ARdetail3.Compose Array(ARheader)
ARdetail4.Compose Array(ARdetail1)
On Error GoTo ACCPACErrorHandler
error = False
DTPicker1.Format = dtpCustom
DTPicker1.CustomFormat = "dd/MM/yyyy"
intDay = Format(DTPicker1.Value, "dd")
intMonth = Format(DTPicker1.Value, "MM")
intYear = Format(DTPicker1.Value, "yyyy")
If strInvNumber <> "" Then
ARheader.Order = 1
ARheader.Browse "IDCUST = """ & strIDCust & """ AND IDINVC = """ & strInvNumber & """", True
If ARheader.Fetch Then
ARheader.Fields("DATEDUE").Value = DateSerial(intYear, intMonth, intDay) ' Due Date
ARheader.Process
ARheader.Update [red] It fails here [/red]
End If
End If
frmInvoice.Hide
Exit Sub