Developing for Dynamics GP

by David Musgrave (Perth, Australia) and Microsoft Dynamics GP Developer Support Team (Fargo, ND, USA)

Modifier - Reading and Writing Data with ADO Example

Modifier - Reading and Writing Data with ADO Example

  • Comments 3

It has been a while since I posted some example code, so here is one which demonstrates how to write back data using ADO. 

The following VBA example adds the Item Short Description and Standard Cost fields to the Item Transaction Inquiry window and reports. It also allows the Standard Cost to be edited and updated back to the Item Master table.

The VBA code opens the connection when the window or report is opened and closes the connection when the window or report is closed. The script also uses two record sets, one which is read only to retrieve the fields from the Item Master (IV00101) table and the other to enable the updating of the Standard Cost field.

NOTE: The method of opening an ADO connection to SQL Server differs for each version. v8.00 uses the external RetrieveGlobals.dll, v9.00 use the external RetrieveGlobals9.dll and v10.00 uses the built-in UserInfoGet object. v10.00 will need at least Service Pack 1 to use this sample. 

The Knowledge Base (KB) article below demonstrates the different methods:

How to use ActiveX Data Object (ADO) with VBA on a window with Microsoft Dynamics GP and with Microsoft Business Solutions - Great Plains 8.0 (KB 942327) Secure Link

Example code for v8.0, v9.0 & v10.0 is attached at the bottom of the article.

Please see the "Installation Instructions.txt" file in each version's archive for more information.

Attachment: Item ADO Read & Write
Page 1 of 1 (3 items)
Comments Information


Please only post comments relating to the topic of this page.

If you wish to ask a technical question, please use the links in the links section (scroll down, on right hand side) to ask on the Newsgroups or Forums. If you ask on the Newsgroups or Forums, others in the community can respond and the answers are available for everyone in the future.

Leave a Comment
  • Please add 1 and 1 and type the answer here:
  • Post