Modifier – Reading and Writing Data with ADO Example

David Meego - Click for blog homepageThis is a reposting of an article I originally wrote on my Developing for Dynamics GP blog.

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)

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.

Item ADO Read & Write

This article was originally posted on the Developing for Dynamics GP Blog and has been reposted on

3 thoughts on “Modifier – Reading and Writing Data with ADO Example

Please post feedback or comments

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.