Hi there,
Basically I'm looking at the code from a macro created within ACCPAC 5.2 to insert a new customer. I need 2 things explained.
1) How many tables in SQL Server are being modified?
2) I know ARCUS is being used but what tables do the views:
mDBLinkCmpRW.OpenView "AR0022", ARCUSTSTAT2
and
mDBLinkCmpRW.OpenView "AR0021", ARCUSTCMT3
refer to?
So basically it seems to me when a new customer is added with minimum information, 3 tables need to be updated, the ARCUS and 2 unknown tables.
Thank you.
Here's the code from the macro.
*********************************************
Sub MainSub()
'
' ACCPAC Macro file: C:\Program Files\ACCPAC\MACROS\newcust.AVB
' Recorded at: Sat Jun 24 11:38:03 2006
'
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 ARCUSTOMER1 As AccpacCOMAPI.AccpacView
Dim ARCUSTOMER1Fields As AccpacCOMAPI.AccpacViewFields
mDBLinkCmpRW.OpenView "AR0024", ARCUSTOMER1
Set ARCUSTOMER1Fields = ARCUSTOMER1.Fields
Dim ARCUSTSTAT2 As AccpacCOMAPI.AccpacView
Dim ARCUSTSTAT2Fields As AccpacCOMAPI.AccpacViewFields
mDBLinkCmpRW.OpenView "AR0022", ARCUSTSTAT2
Set ARCUSTSTAT2Fields = ARCUSTSTAT2.Fields
Dim ARCUSTCMT3 As AccpacCOMAPI.AccpacView
Dim ARCUSTCMT3Fields As AccpacCOMAPI.AccpacViewFields
mDBLinkCmpRW.OpenView "AR0021", ARCUSTCMT3
Set ARCUSTCMT3Fields = ARCUSTCMT3.Fields
ARCUSTOMER1.Init
ARCUSTSTAT2.Init
ARCUSTSTAT2Fields("CNTYR").PutWithoutVerification ("2006") ' Year
ARCUSTSTAT2Fields("CNTPERD").Value = "06" ' Period
ARCUSTSTAT2.Init
ARCUSTSTAT2Fields("CNTYR").PutWithoutVerification ("2006") ' Year
ARCUSTSTAT2Fields("CNTPERD").Value = "06" ' Period
ARCUSTCMT3.Init
ARCUSTCMT3.Browse "(IDCUST = "" "")", 1
ARCUSTCMT3.Fetch
ARCUSTOMER1Fields("IDCUST").Value = "SOSAH" ' Customer Number
ARCUSTSTAT2.Init
ARCUSTSTAT2Fields("IDCUST").PutWithoutVerification ("SOSAH") ' Customer Number
ARCUSTSTAT2Fields("CNTYR").PutWithoutVerification ("2006") ' Year
ARCUSTSTAT2Fields("CNTPERD").Value = "06" ' Period
ARCUSTCMT3.Init
ARCUSTCMT3Fields("IDCUST").PutWithoutVerification ("SOSAH") ' Customer Number
ARCUSTCMT3.Browse "(IDCUST = ""SOSAH "")", 1
ARCUSTOMER1Fields("NAMECUST").Value = "Hector Sosa" ' Customer Name
ARCUSTOMER1Fields("IDGRP").Value = "5" ' Group Code
ARCUSTOMER1Fields("CODETAXGRP").Value = "1" ' Tax Group
ARCUSTOMER1Fields("TEXTSTRE1").PutWithoutVerification ("123 main streest") ' Address Line 1
ARCUSTOMER1Fields("NAMECITY").PutWithoutVerification ("fort lauderdale") ' City
ARCUSTOMER1Fields("CODESTTE").PutWithoutVerification ("Fl") ' State/Prov.
ARCUSTOMER1Fields("CODEPSTL").PutWithoutVerification ("33312") ' Zip/Postal Code
ARCUSTOMER1Fields("TEXTPHON1").PutWithoutVerification ("954-123-4567") ' Phone Number
ARCUSTOMER1Fields("AMTCRLIMT").PutWithoutVerification ("150.000") ' Credit Limit (Cust. Curr.)
ARCUSTOMER1.Insert
ARCUSTOMER1.Update
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
Basically I'm looking at the code from a macro created within ACCPAC 5.2 to insert a new customer. I need 2 things explained.
1) How many tables in SQL Server are being modified?
2) I know ARCUS is being used but what tables do the views:
mDBLinkCmpRW.OpenView "AR0022", ARCUSTSTAT2
and
mDBLinkCmpRW.OpenView "AR0021", ARCUSTCMT3
refer to?
So basically it seems to me when a new customer is added with minimum information, 3 tables need to be updated, the ARCUS and 2 unknown tables.
Thank you.
Here's the code from the macro.
*********************************************
Sub MainSub()
'
' ACCPAC Macro file: C:\Program Files\ACCPAC\MACROS\newcust.AVB
' Recorded at: Sat Jun 24 11:38:03 2006
'
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 ARCUSTOMER1 As AccpacCOMAPI.AccpacView
Dim ARCUSTOMER1Fields As AccpacCOMAPI.AccpacViewFields
mDBLinkCmpRW.OpenView "AR0024", ARCUSTOMER1
Set ARCUSTOMER1Fields = ARCUSTOMER1.Fields
Dim ARCUSTSTAT2 As AccpacCOMAPI.AccpacView
Dim ARCUSTSTAT2Fields As AccpacCOMAPI.AccpacViewFields
mDBLinkCmpRW.OpenView "AR0022", ARCUSTSTAT2
Set ARCUSTSTAT2Fields = ARCUSTSTAT2.Fields
Dim ARCUSTCMT3 As AccpacCOMAPI.AccpacView
Dim ARCUSTCMT3Fields As AccpacCOMAPI.AccpacViewFields
mDBLinkCmpRW.OpenView "AR0021", ARCUSTCMT3
Set ARCUSTCMT3Fields = ARCUSTCMT3.Fields
ARCUSTOMER1.Init
ARCUSTSTAT2.Init
ARCUSTSTAT2Fields("CNTYR").PutWithoutVerification ("2006") ' Year
ARCUSTSTAT2Fields("CNTPERD").Value = "06" ' Period
ARCUSTSTAT2.Init
ARCUSTSTAT2Fields("CNTYR").PutWithoutVerification ("2006") ' Year
ARCUSTSTAT2Fields("CNTPERD").Value = "06" ' Period
ARCUSTCMT3.Init
ARCUSTCMT3.Browse "(IDCUST = "" "")", 1
ARCUSTCMT3.Fetch
ARCUSTOMER1Fields("IDCUST").Value = "SOSAH" ' Customer Number
ARCUSTSTAT2.Init
ARCUSTSTAT2Fields("IDCUST").PutWithoutVerification ("SOSAH") ' Customer Number
ARCUSTSTAT2Fields("CNTYR").PutWithoutVerification ("2006") ' Year
ARCUSTSTAT2Fields("CNTPERD").Value = "06" ' Period
ARCUSTCMT3.Init
ARCUSTCMT3Fields("IDCUST").PutWithoutVerification ("SOSAH") ' Customer Number
ARCUSTCMT3.Browse "(IDCUST = ""SOSAH "")", 1
ARCUSTOMER1Fields("NAMECUST").Value = "Hector Sosa" ' Customer Name
ARCUSTOMER1Fields("IDGRP").Value = "5" ' Group Code
ARCUSTOMER1Fields("CODETAXGRP").Value = "1" ' Tax Group
ARCUSTOMER1Fields("TEXTSTRE1").PutWithoutVerification ("123 main streest") ' Address Line 1
ARCUSTOMER1Fields("NAMECITY").PutWithoutVerification ("fort lauderdale") ' City
ARCUSTOMER1Fields("CODESTTE").PutWithoutVerification ("Fl") ' State/Prov.
ARCUSTOMER1Fields("CODEPSTL").PutWithoutVerification ("33312") ' Zip/Postal Code
ARCUSTOMER1Fields("TEXTPHON1").PutWithoutVerification ("954-123-4567") ' Phone Number
ARCUSTOMER1Fields("AMTCRLIMT").PutWithoutVerification ("150.000") ' Credit Limit (Cust. Curr.)
ARCUSTOMER1.Insert
ARCUSTOMER1.Update
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