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!

trying to customize ACCPAC 5.1A UI

Status
Not open for further replies.

wardo2

Programmer
Apr 30, 2003
16
CA
I'm totally new to the ACCPAC product as we have just purchased the software. I'm an experienced VB and Java programmer, and I have experimented with the ACCPAC macro feature and creating my own custom forms and using the views to connect to the database and read/write data. What I am wondering is how I can change label captions/hide entire tabs/execute code on button clicks of the existing ACCPAC UI forms (such as Order Entry). Is this even possible? Or would I have to create my own custom forms from scratch and use the views supplied by ACCPAC to talk to the DB?

Any help would be greatly appreciated as I am a complete newcomer to customizing this software and am looking for somewhere to start (the pdf documents that came with the product are not very informative on VBA macro writing).
 
I am not sure if it is possible to customize the existing AccPac forms as you describe.

However you can create your own custom forms/apps in VB and use the AccPac xAPI to fully integrate your VB app with AccPac. The xAPI uses the Accpac views which ensure all business logic is followed and data integrity is maintained. Unfortunatly AccPac does not have any really good documentation on the xAPI (at least I haven't found any).

Add a reference to the ACCPACXAPI 1.1 Type Library in your VB project. You can also download the Accpac SDK which will give you access to AccPac custom contols such as the fiscal period drop down control.

The xAPI requires that system manager be installed locally and an available IAP licence to operate.

Thanks and Good Luck!

zemp
 
Thanks for the quick response zemp. I figured I wouldn't be able to do that kind of customization to the existing forms, but thought I'd see what others had to say. It's unfortunate as I would have liked to be able to avoid creating custom forms to avoid future problems/hassles with product upgrades and delaying the time to implementation of the software so that we lose the benefit of going with a third party solution. At least I know my options now....

Thanks again.
 
Accpac has not yet made very many changes to the xAPI. I had to make some very minor adjustments when AccPac went from 4.1 to 4.2. I have not had to make any code changes in the xAPI from 4.2 to 5.1. Yet....crossing my fingers...

Also, just because I don't know if you can manipulate the current Accpac forms doesn't mean you can't. Take some time and look into it further.

Thanks and Good Luck!

zemp
 
Thanks zemp....is there any documentation on using the xAPI objects? I can't find any in the pdf's provided with ACCPAC and I'm not sure where to start.

I have managed to record macros and look at their code, then customize it and use it with my own custom form, all from within the ACCPAC VBA environment. But, this does not use the xAPI, so I have no starting point. If you could just give me a quick sample of how I might use the xAPI to connect and retrieve data from the database. So far, I have:

Dim OSess As ACCPACXAPILib.xapiSession
Dim oView As ACCPACXAPILib.IxapiView

OSess.Open "ADMIN", "", "DATSD", Date, 0
oView = OSess.OpenView("AR0024", "ProgramId")
oView.Browse "", True

The view I want to open is AR0024 so that I can retrieve customer information, but where do I get the program id string? In the ACCPAC VBA, they use an AccpacView argument instead, so no help there. Here is the code that was generated from the macro that I need to emulate in the VB environment using the xAPI object:

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 ARCUSTOMER20 As AccpacCOMAPI.AccpacView
Dim ARCUSTOMER20Fields As AccpacCOMAPI.AccpacViewFields
mDBLinkCmpRW.OpenView "AR0024", ARCUSTOMER20
ARCUSTOMER20.Browse "", True
Set ARCUSTOMER20Fields = ARCUSTOMER20.Fields

Thanks again.
 
Here is an example of the basic VB code that I use to get information on a specified customer. I often use a modular or global level session object. When opening the session object, 'Date' is the VB Date() function that returns the current system date. Make sure that it is within the Accpac session date for the company. For example SAMINC session date is 2010, so you will get an error unless you change your computers system date. Probably easier to use a different company.

I use the actual view names for my variables just to keep thing clear and readable months down the road. You can use whatever variable names you wish.

Dim Session As ACCPACXAPILib.xapiSession
Dim ARCUSTOMER As ACCPACXAPILib.xapiView
Dim ARCUSTOMERFields As ACCPACXAPILib.xapiFields

Set Session = CreateObject("ACCPAC.xapisession")
Session.Open "ADMIN", "ADMIN", "SAMINC", Date, 0

Set ARCUSTOMER = Session.OpenView("AR0024", "AR")
Set ARCUSTOMERFields = ARCUSTOMER.Fields

ARCUSTOMER.Init
ARCUSTOMER.Order = 0
ARCUSTOMER.Browse "IDCUST = " & Trim(txtCustID.Text) & "", True
If ARCUSTOMER.Fetch Then
Text1.Text = Trim(ARCUSTOMER.Fields("NAMECUST").Value)
Text2.Text = Trim(ARCUSTOMER.Fields("TEXTSTRE1").Value)
Text3.Text = Trim(ARCUSTOMER.Fields("TEXTSTRE2").Value)
Text4.Text = Trim(ARCUSTOMER.Fields("NAMECITY").Value)
Text5.Text = Trim(ARCUSTOMER.Fields("CODESTTE").Value)
Text6.Text = Trim(ARCUSTOMER.Fields("CODECTRY").Value)
Text7.Text = Trim(ARCUSTOMER.Fields("CODEPSTL").Value)
Text8.Text = Trim(ARCUSTOMER.Fields("TEXTPHON1").Value)
Text9.Text = Trim(.ARCUSTOMER.Fields("TEXTPHON2").Value)
Text10.Text = Trim(ARCUSTOMER.Fields("NAMECTAC").Value)
Else
MsgBox "Customer could not be found."
End If
ARCUSTOMER.Cancel

ARCUSTOMER is a simple view. With views that have headers and multiple details you will also need to compose the views so that the header and details 'talk' to each other properly. You can see how they are composed in the macros and just cut and paste the lines used to compose the views to your VB code. Changing any variable names as necessary.


Thanks and Good Luck!

zemp
 
Thanks zemp. Got the code working fine now, and using the macros to generate most of the code will sure save a lot of time - the only thing to change is the objects used and the variable names (other than the custom logic needed).

Thanks for taking the time to give me a hand - it has really given me a great starting point.

Out of curiosity, when you create your own custom forms, are you using them as replacements for the exisiting U.I. forms, or are they for added functionality? There is some functionality missing in the Order Entry U.I. (missing fields, code to execute on button clicks, etc...) that I would like to add, but don't want to re-invent the Order Entry "wheel" if you know what I mean.... If you do create your own custom forms to replace the existing U.I's, do you add the associated .ocx files to your form, or do you just start from scratch?

Thanks
 
I normally create add on programs that add additional functionallity to ACCPAC and integrate fully with a clients exsisting ACCPAC database. Therefore these are usually start from scratch applications. Often they will mimic parts of ACCPAC, such as entering a new customer, to ensure that all required information is entered or selected. This is where you can add those 'missing' buttons or remove details that you don't use or combine multiple ACCPAC forms into one easy to use form.


Thanks and Good Luck!

zemp
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top