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

create a new batch through vb6 1

Status
Not open for further replies.

warrickvdb

Programmer
Oct 7, 2003
13
ZA
Hi

I have tried recording a Macro that creates a new batch, but all it seems do is create an invoice and use a 'PutWithoutVerification' statement with the new invoice number.

How can I create a new batch, and then get that batch out?
 
I am assuming that you are trying to create an Invoice batch with the xAPI. If so hear is a function that I use to create a new invoice batch and return the new Batch number.

Code:
Private Sub Create_InvBatch()
'// Create the invoice batch.
   Dim ARINVOICEbatch As ACCPACXAPILib.xapiView
   
   On Error GoTo ERR_APHandler
   
   Set ARINVOICEbatch = Session.OpenView("AR0031", "AR")
   With ARINVOICEbatch
      .Init
      .Fields("BTCHDESC").value = "New Batch " & Format(Date, "yyyy-MM-dd")
      .Fields("BTCHTYPE").value = 2 '// Imported.
      .Fields("INVCTYPE").value = 2 '// Summary.
      .Update
      m_lngInvBatch = .Fields("CNTBTCH").value
      .Cancel
   End With
   m_intInvEntry = 0
   Exit Sub
   
ERR_APHandler:
   HandleACCPACError
   Resume Next
End Sub

'Session' is a properly declared and opened xAPI session object of greater than local scope (it's actually global). 'HandleACCPACError' is a procedure that handles all ACCPAC xAPi errors for me. It is the same as the error handlers created by the macros.

If you are not creating an invoice batch then you just need to change the view and field names to the correct batch. The same logic applies.


Take Care,

zemp

"Show me someone with both feet on the ground and I will show you someone who can't put their pants on."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top