Monday, January 9, 2012

VBA AfterUserChanged Event

Actually I have to Enable or disable the window fields based on Populated window fields data.
I tried to achieve this requirement using VBA AfterUserCahnged Event.
But Enable or disabling field on After User changed event is not worked properly. It Woking based on previously populated data in window.

If I debug the code, it is working fine. If I remove debug , it is not working.

So I have written some VBA warning messgae. Now it is worked after the warning message.
But actually I don't want to pop up unnecessary pop ups. So I tried to suppress that warning message using Window_BeforeModelDialog() event.

But that event only capturing the Dexterity pop ups. So Now I have changed my VBA pop up to Dexterity pop up window.

Dim CompilerApp As New Dynamics.Application
Dim CompilerMessage As String
Dim Commands As String
Commands = ""
Commands = Commands & "warning ""Jeganeedhi's POP up""; "
CompilerError = CompilerApp.ExecuteSanscript(Commands, CompilerMessage)

Now I able to catch this window in Window_BeforeModelDialog() event.
Now my customization is working fine..
It may be not a recommended solution..But it saved lots of time to solve this issue.



No comments: