Category Archives: Accpac Macro

#16 Accpac Finder

Date: 17 July 2011

The Finder is a pop-up window that displays records in a column format for a view. Records are displayed in one of two formats, selected by the user. The user can also select the order for record display. If desired, the caller can provide a filter to restrict the records displayed by the Finder.

Uses of the Finder
The Finder can be used for:

Inquiry In this case, the Finder provides a detailed list of items. The user can select the fields to be displayed by the Finder.
Searching In this case, the user chooses the Finder button to initiate the search for a specific item. The selection is placed in a buffer and the Finder is terminated. For this purpose, the Finder should be started modally by the calling program, so that no further work can be done by the caller until a selection has been made.
Selection In this case, the Finder selects an item to be operated on by another object. After the item has been selected, an object is started, and the selection is passed to it. After the object has been started, the Finder can either remain or terminate. If the Finder remains, the object started by the Finder is modeless. Subsequent Finder selections can be made and further instances of the object started. The objects started can be either peers or children of the Finder. If an object started is a peer, the user can terminate the Finder, but any other objects started by the Finder will not be terminated. If an object started is a child of the Finder, terminating the Finder causes all the Finder’s children to also be terminated.
If the Finder terminates after starting an object, the object obviously must have been started as a peer. The Finder provides the primary key for the selected item in the key area of the object that is started. It is also possible for the caller to provide a user area to be passed to the object started by the Finder.

Following is the code to call the finder that will show the item form ICITEM table in Accpac

Private Sub Cmditemfrm_Click()
Dim fnd As AccpacFinder.ViewFinder
Set fnd = New AccpacFinder.ViewFinder
fnd.Session = AccpacSession
fnd.ViewID = “IC0310”
fnd.DisplayFieldIDs = Array(7, 3, 5, 1, 8 )
fnd.ReturnFieldIDs = Array(7, 3)
fnd.Filter = “” ‘condition here
fnd.AutoTabAway = False
If fnd.Finder = True Then
‘Code here
End If
End Sub


1 Comment

Posted by on July 17, 2011 in Accpac Macro, Accpac Support, Sage Accpac


Tags: , , ,

#15 Accpac Views Protocol for INSERTING and UPDATING Data

Date: 10 July 2011

When we are using Accpac views to insert data into Accpac most of the validation it does by itself. This is one of the most important reasons, why we need to use Accpac views to insert or update data into Accpac Database.

The protocol that Accpac follows while doing Insert is as follows:
1. If the next header number is generated by the view, Put zero in the header number field and use Init to generate the next available header number. If the header number is specified by the caller, use Init to initialize the fields of the header, then Put the header
number in the header view.
2. Put the fields in the header.
3. Init detail to initialize the fields.
4. Put zero into the detail number field to insert from the start.
5. Put values in the other detail fields.
6. Verify detail. (Optional.)
7. Insert detail.
8. Go to step 5 until no more detail.
9. Verify header. (Optional.)
10. Insert the header. (This will do a Post of the details.)

Protocol for updating the data in Accpac is as follows (Including deleting the details):
1. Put header key into header view.
2. Read or Browse/Fetch the header view to get to the header.
3. Put the fields to be updated in the header view. (Optional.)
4. Put detail key into the detail view.
5. Read or Browse/Fetch the detail view to get to the detail.
The header number in the detail view should have been set by the header (because of the explicit composition).
6. Put the fields to be updated in the detail view.(Optional.)
7. Verify the detail. (Optional.)
8. Update or delete the detail.
9. Go to step 4 to process another detail.
10. Verify the header. (Optional.)
11.Update the header. (This will do a Post of the details.)

Browse/Fetch is the functions that help us to navigate through the data. Browse property do not have the “Where” or “Having” clause so we can use if condition to filter our data.


Leave a comment

Posted by on July 10, 2011 in Accpac Macro, Sage Accpac


Tags: ,

#4 Sage Accpac and VBA Macros

Date: 03/04/2011

Although the accounting standards and financial practices are same all around the world but its nature of business and regional obligation that make people follow their own way to reach the same destination. In the era of globalization its became important for a company to adopt for a ERP for it wide range of operations. This will help them to better control over the business and further growth, But the rigidity of each industry and there functional flow makes it almost impossible for the ERP to be 100% standard and Implemented with 0% customization.

Every globally recognized ERP software, has its own mechanism for making the Standard ERP localize and to cater all individual business need. Sage Accpac also provide the couple of mechanism to bridge the gap between Standard Accpac application and specific client requirement. One among them is writing a macro to fulfill the specific client requirement that is not possible to do with standard application. So let’s discuss about Macro and how its working inside Accpac as a part of standard ERP.

In the words of WIKIPEDIA Macro is “to the programmer a sequence of computing instructions as a single program statement, making the programming task less tedious and less error-prone”. In context of Accpac Macro is set of instructions written in VB language. As VBA (Macro) file is platform dependent it runs from inside Accpac and will give look and feel as a part of the standard application.

Writing a new macro is as simple as writing a new VB application. Macro is precompiled and we just need to create a short cut on Accpac desktop to run it. Writing a macro has its pro and cons over writing another application.

Advantage of writing a Macro in Sage Accpac ERP:

  1. As a Macro precompile and run inside Accpac it works as per the Accpac session. The macro will automatically pick the session of the company from which it is executing. Hence we do not need to worry about handling the session.
  2. As it runs on the Accpac platform the code length will also be reduced.
  3. We can use standard Accpac controls and there features. It will allows us to do the changes in any Accpac screen or any Accpac standard functionality, although least recommendable (See point #2 and #3 of disadvantage for more details).

Disadvantage of writing a Macro in Sage Accpac ERP:

  1. Accpac Macro cannot execute if session is not open on the PC where we need to run the macro. We need Accpac session open on the same PC to make macro run. Therefore even if the user wants only to run a macro we need to install Accpac workstation or Accpac application on the client’s PC.
  2. If we are using the macro to fulfill the client’s requirement then we need to pay extra care at the time of Accpac upgrade. At the time of upgrade we need to check each macro with the new version of Accpac and might need changes accordingly.
  3. If we are using some Accpac controls in our macro for changing its functionality it will not work once we upgrade Accpac to the new version. In that case we need to link the macro to the new control, by refreshing references.

Further, one may face problem after upgrade and macro stops working with error “Object not found”. In that case we can check by deleting all .box and .exd files, mainly in the folder “C:/Document and Setting/Computer name/ApplicationData/Microsoft/forms”.

Once after considering pro and cons of Accpac macro we have to decide to write a macro or a VB executable to fulfill client requirements. It is always recommendable to reduce the customizations of the standard product as much as possible.



Posted by on April 3, 2011 in Accpac Macro


Tags: , , , ,

%d bloggers like this: