VBA – Modal Dialog Box Event post in GP Dev Newsgroup


There was a post in Microsoft GP Developer Newgroup, Suppress Dialog Box. The question is briefed as follows:

On the Cash Receipts Entry window, the message “Account is empty. Do you want to save the changes with errors?” needs to be suppressed as the users are not allowed to enter an Account in the CR Distribution Window.

The owner of the post was trying to handle this with VBA’s Window_BeforeModalDialog() event. The message was still coming up and a solution was sought. I checked this and found one really interesting simple reason behind it:

The message “Account is empty. Do you want to save the changes with errors?” has got two SPACEs between it’s two statements. So actually the message is something like this:

Account is empty.[SPACE][SPACE]Do you want to save the changes with errors?

I also got this message popping up invariably after adding the validation when I checked the PromptString (the parameter in VBA event function which contains the message text) against the following message:

Account is empty.[SPACE]Do you want to save the changes with errors?

So how we can avoid this? We have to first display the PromptString on a Message Box and then copy that message to your validations. This will ensure that we are capturing the correct Prompt Message from our VBA code. What we see in GP does not really give us an accurate vision of each message that we see. We do not know where an extra space is added.

Just thought of sharing this, as someone may find this helpful.

VAIDY

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s