1. Add a reference to the 'ACCPACXAPI 1.1 Type Library' To your project.
2. Create and open a xAPI session object.
Dim session As ACCPACXAPILib.xapiSession
Set session = CreateObject("ACCPAC.xapisession"
session.Open <UserName>, <Password>, <Database>, Date, 0
Username and Password are valid accpac usernames and passwords. Such as "ADMIN", "ADMIN". Database is your valid company ID. Such as "SAMLTD" for the ACCPAC sample company.
3. Decalare and open the view.
Dim GLACCOUNT As ACCPACXAPILib.xapiView
Set GLACCOUNT = session.OpenView("GL0001", "GL"
4. Use the view to fill the combo box.
Combo1.Clear
With GLACCOUNT
.Init
.Order = 0
.Browse "", True
Do While .Fetch
Combo1.AddItem .Fields("ACCTID".value
Loop
.Cancel
End With
5. Destroy the objects when not needed.
Set GLACCOUNT = Nothing.
That's it in a nutshell. If you have any errors or problems let us know. this was off the top of my head.
One thing, if you have a lot of accounts then your combo box might get pretty long. It might be better to use a finder like Accpac does.
The ACCTID are the unformatted account numbers. If you want to use the formatted account numbers substitute "ACCTFMTTD" for "ACCTID" in the code.
I followed your instructions as above but to load my "Contract No". My problem is the contract no is of string value and it is not sorted when it is loaded to the combo box. Is there anyway i can sort my combo box data???
If that doesn't work or takes to long then try the following.
1. Load the values into an string array.
2. Sort the array using a bubble sort (if not too big) or a shell sort.
2. Load the combo box with the sorted array.
See thread222-100795 for an example of the bubble sort and a link to example of other sorts including the shell sort.
I like to use a custom ACCPAC finder. Depending on the objects you use you can add a reference to an ACCPAC control or you can use a class and a form as part of your project. See thread631-621905.
I'm trying to import the finderfrm from the bas project into my project but keep hitting error. the error logged in the finderform.log file as as follows:
Line 2: Property OleObjectBlob in FinderForm could not be set.
Check the references for the macro to see if there is something it is referencing that you are not. If so you will need to reference it or remove it from the form.
I would expect that some minor changes may need to be done. I don't think that all of the forms controls are standard controls. One of them is a Rich text box. For Win98 that control needs to be replaced with a standard text box.
If you are still stuck post the line of code that is throwing the error.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.