Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing the print status of an order in 5.2

Status
Not open for further replies.
Dec 2, 2003
12
0
0
Hi, I am having a hard time trying to change the print status of an order. Is this possible? Anyway, here is the code and I am not sure if it is ok.

Sub MainSub()

On Error GoTo ACCPACErrorHandler

Dim mDBLinkCmpRW As AccpacCOMAPI.AccpacDBLink
Set mDBLinkCmpRW = OpenDBLink(DBLINK_COMPANY, DBLINK_FLG_READWRITE)

Dim mDBLinkSysRW As AccpacCOMAPI.AccpacDBLink
Set mDBLinkSysRW = OpenDBLink(DBLINK_SYSTEM, DBLINK_FLG_READWRITE)

Dim OEORD1header As AccpacCOMAPI.AccpacView
Dim OEORD1headerFields As AccpacCOMAPI.AccpacViewFields
mDBLinkCmpRW.OpenView "OE0520", OEORD1header
Set OEORD1headerFields = OEORD1header.Fields

Dim OEORD1detail1 As AccpacCOMAPI.AccpacView
Dim OEORD1detail1Fields As AccpacCOMAPI.AccpacViewFields
mDBLinkCmpRW.OpenView "OE0500", OEORD1detail1
Set OEORD1detail1Fields = OEORD1detail1.Fields

Dim OEORD1detail2 As AccpacCOMAPI.AccpacView
Dim OEORD1detail2Fields As AccpacCOMAPI.AccpacViewFields
mDBLinkCmpRW.OpenView "OE0680", OEORD1detail2
Set OEORD1detail2Fields = OEORD1detail2.Fields

Dim OEORD1detail3 As AccpacCOMAPI.AccpacView
Dim OEORD1detail3Fields As AccpacCOMAPI.AccpacViewFields
mDBLinkCmpRW.OpenView "OE0180", OEORD1detail3
Set OEORD1detail3Fields = OEORD1detail3.Fields

Dim OEORD1detail4 As AccpacCOMAPI.AccpacView
Dim OEORD1detail4Fields As AccpacCOMAPI.AccpacViewFields
mDBLinkCmpRW.OpenView "OE0740", OEORD1detail4
Set OEORD1detail4Fields = OEORD1detail4.Fields

Dim OEORD1detail5 As AccpacCOMAPI.AccpacView
Dim OEORD1detail5Fields As AccpacCOMAPI.AccpacViewFields
mDBLinkCmpRW.OpenView "OE0526", OEORD1detail5
Set OEORD1detail5Fields = OEORD1detail5.Fields

OEORD1header.Compose Array(OEORD1detail1, OEORD1detail2, OEORD1detail3, OEORD1detail4, OEORD1detail5)
OEORD1detail1.Compose Array(OEORD1header)
OEORD1detail2.Compose Array(OEORD1header, OEORD1detail1)
OEORD1detail3.Compose Array(OEORD1header, OEORD1detail1)
OEORD1detail4.Compose Array(OEORD1header)
OEORD1detail5.Compose Array(OEORD1header)

OEORD1header.Browse "ORDNUMBER=ORD000000000065", True
'MsgBox OEORD1header.Fields("PRINTSTAT")

Do Until OEORD1header.Fetch = False
OEORD1header.Fields("PRINTSTAT").PutWithoutVerification "3"
OEORD1header.Process
OEORD1header.Update
'MsgBox OEORD1header.Fields("PRINTSTAT")
Loop

Set OEORD1header = Nothing

Exit Sub

ACCPACErrorHandler:
Dim lCount As Long
Dim lIndex As Long

If Errors Is Nothing Then
MsgBox Err.Description
MsgBox "VBA Macros cannot run where Accpac is deployed as a Web Server"
Else
lCount = Errors.Count

If lCount = 0 Then
MsgBox Err.Description
Else
For lIndex = 0 To lCount - 1
MsgBox Errors.Item(lIndex)
Next
Errors.Clear
End If
Resume Next

End If

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top