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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating ARCUSO optional fields - VB Macro

Status
Not open for further replies.

oxie18

Programmer
Feb 17, 2015
40
CA
thread631-1420246

Hello!

I am just new to Accpac and I'm trying to insert new customer optional field. I have checked threads related to this but I can't seem to make this work. Here is the code snippet. The code runs without errors but no records are inserted to ARCUSO in the database. Any help would be appreciated. Thanks in advance!

Code:
Dim mDBLinkCmpRW As AccpacCOMAPI.AccpacDBLink
Set mDBLinkCmpRW = OpenDBLink(DBLINK_COMPANY, DBLINK_FLG_READWRITE)
        
' Declare Accpac views
'Dim viewARCUS As AccpacCOMAPI.AccpacView
Dim viewARCUSO As AccpacCOMAPI.AccpacView
        
' Open Accpac views
mDBLinkCmpRW.OpenView "AR0400", viewARCUSO
        
' Compose Accpac views
viewARCUSO.Compose Array("AR0024")
    
viewARCUSO.Fields("IDCUST").PutWithoutVerification (strCustId)
viewARCUSO.Read
viewARCUSO.RecordGenerate 0
viewARCUSO.Fields("IDCUST").Value = strCustId
viewARCUSO.Fields("OPTFIELD").Value = "PRICLISTCODE"
viewARCUSO.Fields("VALIFTEXT").Value = UCase(Mid(frmProcessing.CMBGroups.Text, 1, 6))
viewARCUSO.Insert
viewARCUSO.Fields("OPTFIELD").PutWithoutVerification ("PRICLISTCODE")
        
dsCustomer.Update             ' dsCustomer - uses ARCUS view with autocompose = True
 
Go back to your recorded macro and look at how they open the ARCUS and ARCUSO views and compose them.
What you are doing simply makes no sense.

Sage 300 ERP Certified Consultant
 
Why? The ARCUS view is automatically composed via the datasource control dsCustomer. You mean I need to redeclare, reopen and recompose the view for ARCUS?
 
I got this working. I just followed the recorded macro instead of using the dsCustomer control.
 
Data sources are funny things. I generally try to avoid creating/using my own and drive everything via views directly.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top