DynDeveloper.com

DynDeveloper.com

Sign Up Now! Log In
Joel 10/12/2011 9:36:59 AM

VBA Mod - Disable the post button in the PM Batches window

* This article, and all our great VBA documentation, Is available on the VBA/Modifier menu

This article describes the code needed to create a VBA mod in GP 10 to keep a user from posting a Payables batch if that user is the one that created the batch.

We take several steps to accomplish this. The first step is a SQL trigger that records the user id in the SY00500 table. Dynamics does not correctly record the user, so we fix that.

Second, we trap the Origin_Changed and BatchID_Changed events and we look up the batch in SY00500. Based on the userID there, we enable/disable the post button on the form.

There is a bug in this form, the BatchID and Origin_Changed events don't fire correctly when the user looks up a '2' document. We get around that by trapping the PostingDate_Changed event.

Also, an error occurs if you try to enable the post button when the last document was a type '2'. We get around that by using an empty error handler.

 

Version: GP 10
Section: VBA