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!

Seeking Data in GLAMF Table 1

Status
Not open for further replies.

EVISSER

Programmer
Jun 3, 2003
32
AN
I am using Visual Basic ado to connect to the GLAMF table in Accpac. Now I want to use the seek method to find a particular record in the table. First I have to tell which fields are indexed in the GLAMF table.

Question: How can I know which fields are indexed?
: Is there any other function to find a record table ?

E.Visser
 
What are you trying to do with the data? If you plan on manipulating or updating it in any way then you should use the xAPI (or COMAPI) objects that ACCPAC supplies for you. They will ensure that all ACCPAC business logic is followed so that you do not end up with corrupted data. In fact they use the same views that the ACCPAC program uses.

From VB it is fairly simple to open an ACCPAC session and open the correct view for GLAMF. You can then use the .browse method to find a record and the views indexed fields will be used to make the search quick.

If you are interested in using the xAPI, search this forum for 'xAPI' or look through some of my other posts. I have examples of how to create an ACCPAC xAPI session and how to open and browse a view. You will need to add a reference to the ACCPACXAPI 1.1 Type library to your project.

For the record, I would stongly suggest that you use the ACCPAC objects (xAPI is what I use). A small learning curve is better than fixing corrupt data. If you have any other questions or get stuck just post again.

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."
 
FYI, the view for GLAMF is 'GL0001'. There are 13 indexed fields in the table.

If you have the SDK installed you can find a view information program located in the Start-Programs-ACCPAC-Tools folder. This will list the views and which table they correspond to and all the field information.

You can also open ACCPAC go to the Macro-edit menu and open a ca-ble macro (WROFFEUR.mac for example). Then go to debug-object information and you can find the view information there (Scrool for GLACCOUNT). You will see a button labeled 'key info...'. That lists all the indexed fields.

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."
 
Zemp many thanks for the prompt reply. I followed your suggestion and started using xAPI. I tried with a simple browse and did a Fetch on a particular record. But my concern is now I would like to iterate through the recordset to load a combobox with Account data.

How can I move the Recordpointer to the first record?
How do I further do a movenext?
How can I check for the EOF?

Where can I find record operations commands?

Set Session = CreateObject("ACCPAC.xapisession")
Session.Open "ADMIN", "V1PER", "CTBDAT", Date, 0
Set GLACCOUNTS = Session.OpenView("GL0001", "GL")

With GLACCOUNTS
.Init
.Browse "FSCYR= 2003", True

???????
 
The .fetch method will move to the next logical record in the recordset. After you execute a .browse you are not actually on any record like you would be with ADO. You have to 'fetch' the first record. If a record is found then the .fetch method return true.

With this in mind you can use .fetch to move through the recordset. Check for true each time and when .fetch returns false you are at the end of the recordset. Something like this.

Code:
GLACCOUNTS
  .Init
  .Browse "FSCYR= 2003", True
  Do While .Fetch
    ... some code (load combo)
  loop
  .Cancel
End With
Set GLACCOUNTS = Nothing

The .cancel closes the view and setting it to nothing properly disposes of it and releases the memory it consumed. Make sure that it is done within the correct scope.


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