Joel
4Penny.net
Points: 10550

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.

 

4Penny.net
Version: GP 10
Section: VBA
Table Definition Quick Links
All Tables
SOP Tables
RM Tables
GL Tables
POP Tables
HR Tables
PM Tables
UPR Tables
IV Tables
Olympic Tables
3